Terragrunt folder structure and include
Terragrunt projects split config into two layers: a root hcl file with shared settings, and per-unit terragrunt.hcl files that inherit from it.
root.hcl environments/ ├── dev/ │ ├── vpc/ │ │ └── terragrunt.hcl │ ├── rds/ │ │ └── terragrunt.hcl │ └── eks/ │ └── terragrunt.hcl └── prod/ ├── vpc/ │ └── terragrunt.hcl ├── rds/ │ └── terragrunt.hcl └── eks/ └── terragrunt.hcl
Each leaf terragrunt.hcl is one Terraform unit - its own state file, its own apply.
include - inherit from root
# environments/prod/vpc/terragrunt.hcl include "root" { path = find_in_parent_folders ( "root.hcl" ) }
terraform { source = "git::https://github.com/org/tf-modules.git//vpc?ref=v1.2.0" }
inputs = { name = "prod-vpc" cidr_block = "10.0.0.0/16" }
root.hcl
# root.hcl locals { env = basename ( dirname ( get_terragrunt_dir ())) region = "eu-west-1" }
remote_state { backend = "s3" config = { bucket = "my-tf-state" key = "${path_relative_to_include()}/terraform.tfstate" region = local .…