terragrunt.hcl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. locals {
  2. # If you want to use any of the variables in _this_ file, you have to load them here.
  3. # However, they will all be available as inputs to the module loaded in terraform.source
  4. # below.
  5. environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
  6. partition_vars = read_terragrunt_config(find_in_parent_folders("partition.hcl"))
  7. region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
  8. account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
  9. global_vars = read_terragrunt_config(find_in_parent_folders("globals.hcl"))
  10. }
  11. # Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
  12. # working directory, into a temporary folder, and execute your Terraform commands in that folder.
  13. terraform {
  14. # Double slash is intentional and required to show root of modules
  15. source = "git@github.xdr.accenturefederalcyber.com:mdr-engineering/xdr-terraform-modules.git//base/codebuild_lcp_magic_machine?ref=v5.0.0"
  16. }
  17. # KMS Key
  18. dependency "codebuild-ecr-base" {
  19. config_path = "../075-codebuild-ecr-base"
  20. }
  21. # Service Role
  22. dependency "standard-iam" {
  23. config_path = "../005-standard-iam"
  24. }
  25. # S3 bucket dependency
  26. dependency "xdr-binaries" {
  27. config_path = "../008-xdr-binaries"
  28. }
  29. # S3 bucket policy dependency
  30. dependency "xdr-s3-binaries-policy" {
  31. config_path = "../110-xdr-binaries-write-role"
  32. }
  33. # VPC id dependency
  34. dependency "codebuild-vpc" {
  35. config_path = "../360-codebuild-vpc"
  36. }
  37. #Github specific provider
  38. generate "required_providers" {
  39. path = "required_provider.tf"
  40. if_exists = "overwrite_terragrunt"
  41. contents = <<EOF
  42. terraform {
  43. required_providers {
  44. aws = {
  45. source = "hashicorp/aws"
  46. version = "4.4.0" # 2022-03-08: upgrade from 3.63.0; 2021-09-21: upgrade from 3.37.0
  47. }
  48. vault = {
  49. source = "hashicorp/vault"
  50. version = "3.4.1" # 2022-04-08: upgrade from 2.19.1; 2021-04-29: upgrade from 2.18.0
  51. }
  52. sensu = {
  53. source = "jtopjian/sensu"
  54. version = "0.12.1" # 2022-04-06: upgrade from 0.10.5
  55. }
  56. github = {
  57. source = "integrations/github"
  58. version = "~> 4.0" # 2022-04-06: upgrade from 4.2.0
  59. }
  60. }
  61. }
  62. EOF
  63. }
  64. generate "github-provider" {
  65. path = "github-provider.tf"
  66. if_exists = "overwrite_terragrunt"
  67. contents = <<EOF
  68. provider "github" {
  69. owner = "mdr-engineering"
  70. base_url = "https://github.xdr.accenturefederalcyber.com/"
  71. }
  72. EOF
  73. }
  74. # Include all settings from the root terragrunt.hcl file
  75. include {
  76. path = find_in_parent_folders()
  77. }
  78. # These are the variables we have to pass in to use the module specified in the terragrunt source above
  79. inputs = {
  80. # All of the inputs from the inherited hcl files are available automatically
  81. # (via the `inputs` section of the root `terragrunt.hcl`). However, modules
  82. # will be more flexible if you specify particular input values.
  83. tags = {
  84. Purpose = "Build LCP VMware Image"
  85. Terraform = "aws/${basename(get_parent_terragrunt_dir())}/${path_relative_to_include()}/"
  86. }
  87. name = "vmware-lcp-magic-machine"
  88. repository_name = "xdr-images"
  89. service_role = dependency.standard-iam.outputs.service_role
  90. xdr-s3-binaries-policy = dependency.xdr-s3-binaries-policy.outputs.binaries_writers_policy
  91. kms_key = dependency.codebuild-ecr-base.outputs.kms_key
  92. vpc_id = dependency.codebuild-vpc.outputs.vpc_id
  93. public_subnets = dependency.codebuild-vpc.outputs.public_subnets
  94. private_subnets = dependency.codebuild-vpc.outputs.private_subnets
  95. github_clone_url = "https://github.xdr.accenturefederalcyber.com/mdr-engineering/xdr-images"
  96. source_version = "main"
  97. webhook_filter_pattern = "^refs/heads/main$"
  98. buildspec = "base/rhel7/vmware/buildspec.yml"
  99. }
  100. terraform_version_constraint = "= 1.1.6"
  101. terragrunt_version_constraint = "= 0.36.2"