-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters