Skip to content

path.unit

unitstring

A field of the path variable.

Usage

path.unit is defined in a unit, and in every file that the unit includes or reads. It has the same value in each of those files.

It is not defined in terragrunt.stack.hcl, in a file that the stack file reads, or in the terragrunt.values.hcl beside it.

Examples

A root file gives each unit that includes it a different state key.

root.hcl
remote_state {
backend = "s3"
config = {
bucket = "my-tofu-state"
key = "${trimprefix(path.unit, "${dirname(path.include)}/")}/tofu.tfstate"
region = "us-east-1"
}
}