Code Layout - Terragrunt & Terraform

Details about the code layout.

Code layout based on Terragrunt recommendations

├── env                                  # Environments or Deployments
│   ├── prod                             # Production
│   │   ├── terraform.tfvars             # 
│   │   └── terragrunt.hcl               # Use Terragrunt to get DRY code
<snip>
├── modules                              # Terraform modules, ideally standalone, no Terragrunt 
│   ├── infra-cicd                       # 
│   │   ├── README.md                    # 
│   │   ├── data.tf                      # All TF data sources in one place
│   │   ├── files                        #
│   │   │   └──                          # Static files 
│   │   ├── main.tf                      # All TF local variables in one place
│   │   ├── outputs.tf                   # All TF outputs in one place
│   │   ├── templates                    # templates for TF templatefile() function
│   │   │   └──                          # 
│   │   └── variables.tf                 # All TF variables in one place
<snip>
├── stacks                               # Abstract different bunches of modules together into stacks
│   ├── full                             # 
│   │   ├── data.tf                      # 
│   │   ├── outputs.tf                   # 
│   │   ├── terraform.tf                 # 
│   │   └── variables.tf                 # 
│   └── lite                             # 
<snip> 
    └── terragrunt.hcl                   # Stack level Terragrunt for DRY code
└── terragrunt.hcl                       # Top level Terragrunt - usually providers

Code on Github.

links

social