Each attribute in a locals block sets a value that the file reads as local.<name>:
terragrunt.hcl
locals {
region ="us-east-1"
bucket ="${local.region}-bucket"
}
inputs ={
region= local.region
bucket_name= local.bucket
}
A file can have one locals block. A local can read other locals, include, feature, and values, but not dependency outputs. Read those in inputs instead.
Locals belong to the file that sets them, so a unit and the files it includes can’t read each other’s locals. To read an included file’s locals, set expose = true on the include block and read them under include.<name>.locals.
Units that read the same file share one parse of it, unless the file’s result depends on the unit reading it. Then Terragrunt parses the file, and runs its commands, for every unit.
Examples
Reads a value that a parent folder’s file sets for every unit below it.