Inputs, includes & locals
Share config across units.
Beyond state, Terragrunt keeps inputs and settings DRY through includes and locals. An include pulls configuration from a parent file (the same mechanism as the shared backend), and Terragrunt merges parent and child — so common inputs (region, tags, account id) live in a parent and each unit adds only its specifics. locals define reusable values within a file, and you can read shared data (like a region config) from a parent locals file.
locals {environment = "prod"aws_region = "us-east-1"common_tags = { environment = "prod", owner = "platform" }}
include "root" { path = find_in_parent_folders("root.hcl") }locals {env = read_terragrunt_config(find_in_parent_folders("env.hcl")).locals}inputs = {environment = local.env.environment # shared value, defined oncetags = local.env.common_tagsinstance_type = "m5.large" # this unit’s specific input}
Merge behavior and hierarchy
The pattern is a hierarchy of hcl files — a repo root (backend, provider), an account level, an environment level (region, tags), and the unit (its module and specific inputs) — each including the ones above and contributing its layer. Terragrunt deep-merges them, so a value set at the environment level applies to every unit under it unless a unit overrides it. This is how a change like “add a cost-center tag everywhere” is one edit at the right level.