Skip to content

Releases: cloudposse/terraform-yaml-config

0.2.0 Add hierarchical imports and deep-merging of configuration filess

08 Dec 17:30
6c35c07
Compare
Choose a tag to compare

what

  • Add hierarchical imports and deep-merging of configuration files
  • Add examples

why

  • Hierarchical imports - support import up to five level deep (so we can, for example, import environment globals into a stack, which in turn can import globals for the entire solution)
  • All imported maps are deepmerged into a final configuration map for consumption in other terraform modules

test of local imports and deepmerging

Outputs:

list_configs = []
map_configs = {
  "components" = {
    "helmfile" = {
      "nginx-ingress" = {
        "vars" = {
          "installed" = true
        }
      }
    }
    "terraform" = {
      "eks" = {
        "backend" = {
          "s3" = {
            "workspace_key_prefix" = "eks"
          }
        }
      }
      "vpc" = {
        "backend" = {
          "s3" = {
            "workspace_key_prefix" = "vpc"
          }
        }
        "vars" = {
          "cidr_block" = "10.102.0.0/18"
        }
      }
    }
  }
  "helmfile" = {}
  "import" = [
    "imports-level-2",
  ]
  "terraform" = {}
  "vars" = {
    "environment" = "ue2"
    "namespace" = "eg"
    "region" = "us-east-2"
    "stage" = "prod"
  }
}
yaml_config_1_imports = [
  "imports-level-2.yaml",
]
yaml_config_2_imports = [
  "imports-level-3.yaml",
]
yaml_config_3_imports = []
yaml_config_4_imports = []

test of remote imports and deepmerging

Outputs:

list_configs = []
map_configs = {
  "components" = {
    "helmfile" = {
      "nginx-ingress" = {
        "vars" = {
          "installed" = true
        }
      }
    }
    "terraform" = {
      "eks" = {
        "backend" = {
          "s3" = {
            "workspace_key_prefix" = "eks"
          }
        }
        "command" = "/usr/bin/terraform-0.13"
      }
      "vpc" = {
        "backend" = {
          "s3" = {
            "workspace_key_prefix" = "vpc"
          }
        }
        "command" = "/usr/bin/terraform-0.13"
        "vars" = {
          "cidr_block" = "10.102.0.0/18"
        }
      }
    }
  }
  "helmfile" = {}
  "import" = [
    "ue2-globals",
  ]
  "terraform" = {
    "backend" = {
      "s3" = {
        "acl" = "bucket-owner-full-control"
        "bucket" = "eg-ue2-root-tfstate"
        "dynamodb_table" = "eg-ue2-root-tfstate-lock"
        "encrypt" = true
        "key" = "terraform.tfstate"
        "region" = "us-east-2"
        "role_arn" = "arn:aws:iam::xxxxxxxx:role/eg-gbl-root-terraform"
      }
    }
    "backend_type" = "s3"
  }
  "vars" = {
    "environment" = "ue2"
    "namespace" = "eg"
    "region" = "us-east-2"
    "stage" = "prod"
  }
}
yaml_config_1_imports = [
  "https://raw.githubusercontent.com/cloudposse/atmos/master/example/stacks/ue2-globals.yaml",
]
yaml_config_2_imports = [
  "https://raw.githubusercontent.com/cloudposse/atmos/master/example/stacks/globals.yaml",
]
yaml_config_3_imports = []
yaml_config_4_imports = []

0.1.0 Initial implementation

16 Nov 02:56
637e4ad
Compare
Choose a tag to compare

what

  • Initial implementation

why

  • Terraform module to convert local and remote YAML configuration templates into Terraform lists and maps.
  • The module accepts paths to local and remote YAML configuration template files and converts the templates into Terraform lists and maps for consumption in other Terraform modules.
  • The module also accepts a map of parameters for interpolation within the YAML config templates.