terragrunt stack-dependencies resolves nested stack paths
Introduced 2026-04-27 · score 0.95
HOW TO USE IT
When a unit in a parent stack must depend on a nested stack, enable `stack-dependencies` and set the dependency’s `config_path` to `stack.<name>.<nested_stack>.path` (for example, `stack.infra.deep.path`).
unit "app" {
source = "../catalog/units/app"
path = "app"
autoinclude {
dependency "deep" {
config_path = stack.infra.deep.path
}
}
}WHY THIS HELPS
Declare a dependency in a unit of a parent stack on a stack nested inside one of its stacks.
BEFORE THIS CHANGE
Previously, `stack-dependencies` supported `stack.<name>.path` for a whole stack and `stack.<name>.<unit_name>.path` for a unit inside a stack; it did not resolve the nested-stack reference described by this change.
REQUIREMENTS AND LIMITATIONS
- Version: v1.0.3
- Availability: The `stack-dependencies` experiment is required.
- stack-dependencies (required): Experiment to enable for this feature in v1.0.3.
- autoinclude (required): Unit block that supplies configuration merged into the generated unit configuration.
- dependency "deep" (required): Dependency block; `deep` is its label.
- config_path (required): Path to the dependency configuration. Here it uses the nested stack path reference.
- stack.infra.deep.path (required): Reference to the generated path of the `deep` stack nested under `infra`, as stated in the v1.0.3 release note.
- Prerequisite: Enable the `stack-dependencies` experiment.
- Prerequisite: Declare the nested stack in the referenced stack’s `terragrunt.stack.hcl`; the release note example names `catalog/stacks/infra/terragrunt.stack.hcl`.
- Docs conflict: Current HCL blocks documentation says stacks are opaque dependency boundaries and path references cannot target a component inside another stack. This differs from the v1.0.3 release note’s nested-stack behavior; the current page documents a newer behavior/version. https://docs.terragrunt.com/reference/hcl/blocks/
FIRST-PARTY EVIDENCE
- https://github.com/gruntwork-io/terragrunt/releases/tag/v1.0.3
- https://docs.terragrunt.com/reference/hcl/blocks/
Check the installed version and the source before using it. Entry JSON