Menu

1 / 2

What is Terragrunt and why you need it

DEV Community·Bartłomiej Danek·6 months ago
#1G2YTv2T
#terraform#terragrunt#hcl#devops#software
Reading 0:00
15s threshold

What is Terragrunt and why you need it

the multi-env problem

With plain Terraform, managing multiple environments means duplicating config - same modules, different variable files, same backend boilerplate repeated everywhere.

environments/ ├── dev/ │ ├── main.tf # copy │ ├── variables.tf # copy │ └── backend.tf # copy with different key ├── staging/ │ ├── main.tf # copy │ ├── variables.tf # copy │ └── backend.tf # copy with different key └── prod/ ├── main.tf # copy ├── variables.tf # copy └── backend.tf # copy with different key

Enter fullscreen mode

Exit fullscreen mode

Any change to the module requires updating all three.

what Terragrunt does

Terragrunt is a thin wrapper around Terraform that adds:

DRY backend config - define once, inherit everywhere

dependency blocks - wire modules together without a monolith

run-all - apply/plan/destroy across multiple modules in one command

generate blocks - auto-generate files (provider configs, backend configs)

mock_outputs - unblock plan in CI when…

Continue reading — create a free account

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