Terragrunt "local ... is not defined" in CI
Terragrunt evaluated a local.X reference and found no such value in the module locals or the locals merged in from an included parent. The name is misspelled, missing, or lives in a parent that was not included.
What this error means
terragrunt fails with "Unsupported attribute" or "local.X is not defined" while parsing the config, before Terraform runs.
ERRO[0000] Error: Unsupported attribute
on terragrunt.hcl line 8, in inputs:
8: region = local.aws_region
This object does not have an attribute named "aws_region".Common causes
The local is not declared where it is used
The locals { } block in this file does not define the name, and no included parent contributes it.
The parent that defines the local was not included
The value lives in a parent config, but this module has no include (or does not read the parent locals), so the name is undefined here.
How to fix it
Declare the local or read it from the parent
- Confirm which locals block should define the value.
- Add it to this module locals, or read the parent config that defines it.
- Re-run so the reference resolves.
locals {
parent = read_terragrunt_config(find_in_parent_folders("root.hcl"))
aws_region = local.parent.locals.aws_region
}Fix a misspelled attribute name
Match the reference exactly to the declared local name (case and spelling).
How to prevent it
- Define shared locals once in a root config and read them explicitly.
- Keep local names consistent across parent and child configs.
- Run
terragrunt hclvalidatelocally to catch undefined references.