Error: Unsupported attribute (reading a parent local without expose)
Fixes Terragrunt's 'Error: Unsupported attribute' when a child reads a parent's local as local.name. Use when a unit references a local defined in an included config without expose = true. Not for genuinely missing locals.
TL;DR: A parent's locals are NOT inherited by including it. Without expose = true on the include block, the parent's locals aren't reachable at all, and even with it you must read them as include.[label].locals.[name], never bare local.[name].
Error: Unsupported attribute
on child/terragrunt.hcl line 3:
3: inputs = { r = local.region }(where region is defined in the included root's locals)
Steps
- Confirm the local is defined in the INCLUDED file, not the unit.
Expected: locals { region = ... } lives in the parent/shared config.
- Add
expose = trueto the include block:
include "root" {
path = find_in_parent_folders("root.hcl")
expose = true
}Expected: the included config's locals become reachable.
- Change the reference to the exposed path:
locals {
region = include.root.locals.region
} Expected: include.root matches the include block's label exactly.
- Re-run.
Expected: the Unsupported attribute error is gone.
When this applies
Error: Unsupported attributeonlocal.[name]where[name]is defined in an included config.- The include block lacks
expose = true, or the reference uses barelocal.instead ofinclude.[label].locals..
When it doesn't apply
- The local is defined in the unit's own file but misspelled: fix the typo.
- Reading from
read_terragrunt_config(...): the value is under.locals.[name](local.vars.locals.id, notlocal.vars.id).
Tool versions
All Terragrunt 1.x (verified on 1.1.3).
Why it happens
include merges configuration; it does not merge the local. namespace. Each config keeps its own locals, and expose publishes the included config under a separate include.[label] namespace rather than merging it into the child's.
Edge cases
- No
merge_strategy(shallow, deep, no_merge) changes this: locals never merge across files. Twolocalsblocks in the SAME file is a duplicate block error, not a merge. - The label matters:
include.rootrequiresinclude "root"; a mismatched label fails the same way.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.