Skip to content

Commit

Permalink
deps
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Jul 18, 2024
1 parent 5233f3b commit 0325d44
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
72 changes: 72 additions & 0 deletions lab/us-gov-east-1/vpc/cluster/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
locals {
# Automatically load _envcommon, cross account and environment common variables
# common_vars = read_terragrunt_config("${dirname(find_in_parent_folders())}/_envcommon/common-variables.hcl", "skip-account-if-does-not-exist")
// "${get_tfvars_dir()}/${find_in_parent_folders("account.tfvars", "skip-account-if-does-not-exist")}",

# Automatically load account-level variables (NOTE: In our environment account = environment so there is not separate environment layer)
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))

# Automatically load region-level variables
region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))

# Automatically load vpc-level variables
# Not applicable in this demo, but including for reference, would be next level of variables and configurations
# vpc_vars = read_terragrunt_config(find_in_parent_folders("vpc.hcl", "skip-account-if-does-not-exist"))

# Extract the variables we need for easy access
account_name = local.account_vars.locals.account_name
account_id = local.account_vars.locals.aws_account_id
organization = "census:ocio:csvd"
project_number = "fs0000000078"
project_name = "csvd_platformbaseline"
project_role = "csvd_platformbaseline_app"
}

generate "provider" {
path = "provider.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
provider "aws" {
region = "us-gov-east-1"
default_tags {
tags = {
ProjectNumber = "${local.project_number}"
"Project Name" = "${local.project_name}"
"Project Role" = "${local.project_role}"
"Project Identifier" = "fs0000000078:csvd_platformbaseline"
Organization = "${local.organization}"
created_by = "srinivasa.nangunuri@census.gov"
created_for = "srinivasa.nangunuri@census.gov"
created_reason = "Exploration of Terragrunt and Demonstration of CICD for Infrastructure"
Terraform = "true"
Terragrunt = "true"
}
}
# Only these AWS Account IDs may be operated on by this template
allowed_account_ids = ["${local.account_id}"]
}
EOF
}

remote_state {
backend = "s3"
generate = {
path = "backend.tf"
if_exists = "overwrite_terragrunt"
}
config = {
bucket = "tg-infrastructure-tf-state-lab-dev-ew-us-gov-east-1"
key = "platform-eks-test/terraform.tfstate"
region = "us-gov-east-1"
encrypt = true
#dynamodb_table = "my-lock-table"
}
}

inputs = merge(
# local.common_vars.locals,
local.account_vars.locals,
local.region_vars.locals,
# local.vpc_vars.locals,
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ terraform {
dependency "eks" {
config_path = "../eks"
}
dependency "eks-config" {
config_path = "../eks-config"
}
dependency "eks-istio" {
config_path = "../eks-istio"
}

inputs = {
cluster_name = dependency.eks.inputs.cluster_name
Expand Down
3 changes: 3 additions & 0 deletions lab/us-gov-east-1/vpc/mcmCluster/eks-istio/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ terraform {
dependency "eks" {
config_path = "../eks"
}
dependency "eks-config" {
config_path = "../eks-config"
}

inputs = {
profile = dependency.eks.inputs.profile
Expand Down
6 changes: 6 additions & 0 deletions lab/us-gov-east-1/vpc/mcmCluster/eks-loki/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ terraform {
dependency "eks" {
config_path = "../eks"
}
dependency "eks-config" {
config_path = "../eks-config"
}
dependency "eks-istio" {
config_path = "../eks-istio"
}

inputs = {
profile = dependency.eks.inputs.profile
Expand Down

0 comments on commit 0325d44

Please sign in to comment.