docs/src/data/changelog/v1.0.4/stack-dependencies.mdx
stack-dependencies — Nested stack paths and discovery integrationThe stack-dependencies experiment gains two improvements: nested stack path references at arbitrary depth, and integration with the find and list discovery commands.
Nested stack path references
stack.<name>.<nested_stack>.path now resolves at arbitrary nesting depth. Previously, only units within a stack were reachable via stack.<name>.<unit_name>.path; nested stacks are now first-class references too.
# terragrunt.stack.hcl
stack "infra" {
source = "../catalog/stacks/infra"
path = "infra"
}
unit "app" {
source = "../catalog/units/app"
path = "app"
autoinclude {
dependency "deep" {
# infra contains a nested "deep" stack; reference it directly.
config_path = stack.infra.deep.path
}
inputs = {
val = dependency.deep.outputs.val
}
}
}
Discovery commands surface stack dependencies
The terragrunt find and terragrunt list discovery commands now reflect stack dependencies generated by the autoinclude block. The DAG output correctly orders units by their autoinclude dependencies and shows dependency relationships in JSON, tree, and long formats.
# JSON output includes dependency relationships from autoinclude
$ terragrunt find --json --dag --dependencies --experiment stack-dependencies
# Long list format shows a Dependencies column
$ terragrunt list --long --dependencies --dag --experiment stack-dependencies
# Tree format visualizes the dependency hierarchy
$ terragrunt list --tree --dag --experiment stack-dependencies
Multi-level dependency trees (for example, A → B,C where B → D,E) are ordered correctly in DAG mode: leaf units appear first, parents appear after all their dependencies.
To learn more, see the experiment documentation.