Преглед изворни кода

Provider fixes in 005-iam

* Made my 005-iam come back to being identical to skeleton.

* Also added a couple of small fixes to make needed variables in
005-iam visible.
Duane Waddle пре 4 година
родитељ
комит
fafc64a082

+ 8 - 4
000-skeleton/005-iam/terragrunt.hcl

@@ -6,15 +6,18 @@ locals {
   # e.g. inherited variables:
   #environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
   #partition_vars = read_terragrunt_config(find_in_parent_folders("partition.hcl"))
-  #region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
-  #account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
+  region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
+  account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
   #global_vars = read_terragrunt_config(find_in_parent_folders("globals.hcl"))
 
   # Extract out common variables for reuse
-  #env = local.environment_vars.locals.environment
+  #env            = local.environment_vars.locals.environment
+  aws_region     = local.region_vars.locals.aws_region
+  account_id     = local.account_vars.locals.aws_account_id
+  
 }
 
-# For provisioning only. Comment out after provisioning
+# TODO: For provisioning only. Comment out after provisioning
 generate "provider" {
   path      = "provider.tf"
   if_exists = "overwrite_terragrunt"
@@ -27,6 +30,7 @@ provider "aws" {
   version = "~> 3.0"
   region = "${local.aws_region}"
 
+  # TODO: make sure you have a profile matching this
   profile = "tmp"
 
   # Only these AWS Account IDs may be operated on by this template

+ 24 - 20
prod/aws-us-gov/mdr-prod-nihors/005-iam/terragrunt.hcl

@@ -1,21 +1,3 @@
-# TODO: For provisioning only. Comment out after provisioning
-generate "provider" {
-  path      = "provider.tf"
-  if_exists = "overwrite_terragrunt"
-  contents  = <<EOF
-provider "template" {
-  version = "~> 2.1"
-}
-provider "aws" {
-  version = "~> 3.0"
-  region = "${local.aws_region}"
-  profile = ""  # TODO this may need changed based on your ~/.aws/credentials
-  # Only these AWS Account IDs may be operated on by this template
-  allowed_account_ids = ["${local.account_id}"]
-}
-EOF
-}
-
 locals {
   # If you want to use any of the variables in _this_ file, you have to load them here.
   # However, they will all be available as inputs to the module loaded in terraform.source
@@ -29,9 +11,32 @@ locals {
   #global_vars = read_terragrunt_config(find_in_parent_folders("globals.hcl"))
 
   # Extract out common variables for reuse
-  env            = local.environment_vars.locals.environment
+  #env            = local.environment_vars.locals.environment
   aws_region     = local.region_vars.locals.aws_region
   account_id     = local.account_vars.locals.aws_account_id
+  
+}
+
+# TODO: For provisioning only. Comment out after provisioning
+generate "provider" {
+  path      = "provider.tf"
+  if_exists = "overwrite_terragrunt"
+  contents  = <<EOF
+provider "template" {
+  version = "~> 2.1"
+}
+
+provider "aws" {
+  version = "~> 3.0"
+  region = "${local.aws_region}"
+
+  # TODO: make sure you have a profile matching this
+  profile = "tmp"
+
+  # Only these AWS Account IDs may be operated on by this template
+  allowed_account_ids = ["${local.account_id}"]
+}
+EOF
 }
 
 # Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
@@ -55,4 +60,3 @@ inputs = {
     Terraform = "aws/${basename(get_parent_terragrunt_dir())}/${path_relative_to_include()}/"
   }
 }
-