Menu

πŸ“°
0

Terragrunt folder structure and include

DEV Community: terraformΒ·BartΕ‚omiej DanekΒ·about 1 month ago
#IUdxQGY1
#dev#class#code#terragrunt#highlight#photo
Reading 0:00
15s threshold

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 .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More