Terragrunt vs. Pure Terraform: Multi-Account Architecture at Scale
· Sourabh G Kulkarni
Why pure Terraform leads to configuration duplication in multi-account clouds, and how Terragrunt solves backend and variable inheritance.

As cloud infrastructure matures from a single AWS account to multi-account organizations (Development, Staging, Production, and Shared Services), native Terraform hits an ergonomic wall: configuration duplication.
Every single environment requires its own backend "s3" {} block, its own provider configuration, and repetitive variable declarations. If you manage 3 environments across 4 AWS accounts, updating a backend bucket name or adding a common tag requires editing 12 separate files.
Terragrunt acts as a thin wrapper on top of Terraform designed to keep your infrastructure code 100% DRY (Don't Repeat Yourself).
flowchart TD
subgraph RootConfig["Root Terragrunt Layer (DRY Single Source of Truth)"]
RootHcl["terragrunt.hcl (Central Backend & Provider Blocks)"]
end
subgraph Envs["Multi-Account Directory Tree"]
Dev["dev/us-east-1/vpc/terragrunt.hcl"]
Stage["staging/us-east-1/vpc/terragrunt.hcl"]
Prod["prod/us-east-1/vpc/terragrunt.hcl"]
end
subgraph IaCModule["Reusable Pure Terraform Module"]
Mod["git::github.com/company/terraform-aws-vpc?ref=v1.2.0"]
end
RootHcl -->|generate backend & providers| Dev
RootHcl -->|generate backend & providers| Stage
RootHcl -->|generate backend & providers| Prod
Dev -->|inputs: cidr = 10.1.0.0/16| Mod
Stage -->|inputs: cidr = 10.2.0.0/16| Mod
Prod -->|inputs: cidr = 10.0.0.0/16| Mod
1. The Core Power: Remote State Generation
With Terragrunt, you define your S3 backend and DynamoDB lock table once in a root terragrunt.hcl:
# root terragrunt.hcl
remote_state {
backend = "s3"
generate = {
path = "backend.tf"
if_exists = "overwrite_terragrunt"
}
config = {
bucket = "company-tf-state-${get_aws_account_id()}"
key = "${path_relative_to_include()}/terraform.tfstate"
region = "us-east-1"
encrypt = true
dynamodb_table = "terraform-locks"
}
}
Every child directory simply inherits this configuration:
# prod/us-east-1/eks/terragrunt.hcl
include "root" {
path = find_in_parent_folders()
}
terraform {
source = "git::https://github.com/company/terraform-aws-eks.git?ref=v3.2.0"
}
inputs = {
cluster_name = "production-cluster"
node_count = 6
}
Terragrunt automatically interpolates the S3 key as prod/us-east-1/eks/terraform.tfstate. Zero duplicate backend blocks.
2. Managing Inter-Module Dependencies
In pure Terraform, passing outputs from a VPC to an EKS cluster across separate state files requires brittle data "terraform_remote_state" lookups.
Terragrunt introduces first-class dependency blocks:
# prod/us-east-1/eks/terragrunt.hcl
dependency "vpc" {
config_path = "../vpc"
}
inputs = {
vpc_id = dependency.vpc.outputs.vpc_id
private_subnets = dependency.vpc.outputs.private_subnet_ids
}
When you run terragrunt run-all plan or terragrunt run-all apply, Terragrunt calculates the full dependency graph and automatically executes the VPC first, followed by the EKS cluster.
3. Pure Terraform vs. Terragrunt: When to Use Which?
| Metric | Pure Terraform | Terragrunt |
|---|---|---|
| Learning Curve | Standard HCL | Requires understanding wrapper lifecycle |
| Backend Config | Duplicated across every state folder | Defined once at root (remote_state) |
| Cross-Module Outputs | data "terraform_remote_state" | Explicit dependency blocks |
| Multi-Stack Deploy | Manual sequential runs | run-all apply with DAG ordering |
| Tooling Ecosystem | Universal support | Requires Terragrunt binary in CI/CD |
The Recommendation
For single-account or simple architectures, stick with pure Terraform using structured modules. As soon as you scale to multiple AWS accounts or environments that require isolated state files, Terragrunt saves hundreds of hours of configuration maintenance.