terragrunt.hcl 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # TODO: For provisioning only. Comment out after provisioning
  2. generate "provider" {
  3. path = "provider.tf"
  4. if_exists = "overwrite_terragrunt"
  5. contents = <<EOF
  6. provider "template" {
  7. version = "~> 2.1"
  8. }
  9. provider "aws" {
  10. version = "~> 3.0"
  11. region = "${local.aws_region}"
  12. profile = "" # TODO this may need changed based on your ~/.aws/credentials
  13. # Only these AWS Account IDs may be operated on by this template
  14. allowed_account_ids = ["${local.account_id}"]
  15. }
  16. EOF
  17. }
  18. locals {
  19. # If you want to use any of the variables in _this_ file, you have to load them here.
  20. # However, they will all be available as inputs to the module loaded in terraform.source
  21. # below.
  22. # e.g. inherited variables:
  23. #environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
  24. #partition_vars = read_terragrunt_config(find_in_parent_folders("partition.hcl"))
  25. region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
  26. account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
  27. #global_vars = read_terragrunt_config(find_in_parent_folders("globals.hcl"))
  28. # Extract out common variables for reuse
  29. env = local.environment_vars.locals.environment
  30. aws_region = local.region_vars.locals.aws_region
  31. account_id = local.account_vars.locals.aws_account_id
  32. }
  33. # Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
  34. # working directory, into a temporary folder, and execute your Terraform commands in that folder.
  35. terraform {
  36. # Double slash is intentional and required to show root of modules
  37. source = "git@github.mdr.defpoint.com:mdr-engineering/xdr-terraform-modules.git//base/iam?ref=v1.0.0"
  38. }
  39. # Include all settings from the root terragrunt.hcl file
  40. include {
  41. path = find_in_parent_folders()
  42. }
  43. # These are the variables we have to pass in to use the module specified in the terragrunt source above
  44. inputs = {
  45. # All of the inputs from the inherited hcl files are available automatically
  46. # (via the `inputs` section of the root `terragrunt.hcl`). However, modules
  47. # will be more flexible if you specify particular input values.
  48. tags = {
  49. Terraform = "aws/${basename(get_parent_terragrunt_dir())}/${path_relative_to_include()}/"
  50. }
  51. }