dev and prod) by leveraging the community-maintained Terraform module terraform-aws-modules/vpc/aws. Community modules accelerate delivery by providing well-tested patterns, reducing duplicate code, and improving maintainability.
How this works in brief:
- Each environment (for example,
live/dev/vpcandlive/prod/vpc) contains aterragrunt.hclthat points at the VPC module and supplies environment-specific inputs. - Terragrunt downloads the module, renders variables, and runs Terraform commands (init/plan/apply) for that environment.

- Create a
terragrunt.hclfile for each environment (for example,devandprod). Eachterragrunt.hclreferences the community VPC module and supplies inputs specific to that environment. - From the environment directory, run the Terragrunt CLI to initialize, plan, and apply the configuration.
terragrunt.hcl that references the terraform-aws-modules/vpc/aws module and provides common inputs. Place one version of this file in each environment directory and customize the inputs as needed.
?ref=v3.14.0) to ensure reproducible builds and reduce unexpected changes from upstream.
Common inputs reference
Recommended Terragrunt CLI sequence
- Change into the environment directory that contains your
terragrunt.hcl:
- Initialize the working directory (downloads modules and providers):
- Generate and inspect a plan for the proposed changes:
- Apply the planned changes to create the VPC:
- Keep environment-specific values such as CIDR blocks, AZ lists, subnet sizes, tags, and naming conventions inside each environment’s
terragrunt.hcl. - Use the same module source across environments to ensure consistent architecture while varying inputs to meet environment constraints.
Always review the
terragrunt plan output before applying—this helps avoid accidental changes. Keep environment-specific values (for example, CIDR blocks and tags) in each environment’s terragrunt.hcl so deployments remain consistent and reproducible.- Module: https://github.com/terraform-aws-modules/terraform-aws-vpc
- Terragrunt documentation: https://terragrunt.gruntwork.io/
- Terraform documentation: https://www.terraform.io/docs/index.html