terragrunt.stack.hcl autoinclude dependency wiring with stack-dependencies
Introduced 2026-04-13 · score 0.92
HOW TO USE IT
When generating a stack with unit dependencies or configuration overrides, enable the `stack-dependencies` experiment and put an `autoinclude` block inside the unit in `terragrunt.stack.hcl`. Then run the plan command across all units.
unit "app" {
source = "../catalog/units/app"
path = "app"
autoinclude {
dependency "vpc" {
config_path = unit.vpc.path
}
inputs = {
vpc_id = dependency.vpc.outputs.vpc_id
}
}
}terragrunt run --all --experiment stack-dependencies -- planWHY THIS HELPS
Define dependencies and configuration overrides between units when generating a stack.
REQUIREMENTS AND LIMITATIONS
- Version: v1.0.1
- Availability: experiment
- --all (required): Run the specified OpenTofu/Terraform command against all units in the current stack.
- --experiment stack-dependencies (required): Enable the stack-dependencies experiment for this run.
- autoinclude (required): Block in a unit that enables dependency relationships and configuration overrides during stack generation.
- dependency "vpc" (required): Declare a dependency named `vpc` in the autoinclude block.
- config_path (required): Set the dependency configuration path to `unit.vpc.path`.
- inputs: Set the generated unit input `vpc_id` from `dependency.vpc.outputs.vpc_id`.
- -- / plan (required): The separator passes `plan` as the OpenTofu/Terraform command.
- Prerequisite: Use Terragrunt v1.0.1, the release version that introduces this experiment.
- Docs conflict: Current active-experiments documentation does not list `stack-dependencies`; current v1.1 release documentation says the feature is enabled by default there. Those newer docs do not establish v1.0.1 behavior, so the v1.0.1 release note is used for the experiment requirement.
FIRST-PARTY EVIDENCE
- https://github.com/gruntwork-io/terragrunt/releases/tag/v1.0.1
- https://docs.terragrunt.com/reference/cli/commands/run/
Check the installed version and the source before using it. Entry JSON