docs/src/data/commands/stack/generate.mdx
import FileTree from "@components/vendored/starlight/FileTree.astro"; import { Aside } from "@astrojs/starlight/components";
# terragrunt.stack.hcl
unit "mother" {
source = "units/chicken"
path = "mother"
}
unit "father" {
source = "./units/chicken"
path = "father"
}
unit "chick_1" {
source = "./units/chick"
path = "chicks/chick-1"
}
unit "chick_2" {
source = "units/chick"
path = "chicks/chick-2"
}
Running the following:
terragrunt stack generate
Generates the following stack:
<FileTree>terragrunt stack generate --parallelism 4
Automatic Discovery: The command automatically discovers all terragrunt.stack.hcl files within the directory structure and generates them in parallel.
Validation of Units and Stacks: During the stack generation, the system will validate that each unit and stack's target directory contains the appropriate configuration file (terragrunt.hcl for units and terragrunt.stack.hcl for stacks). This ensures the directories are correctly structured before proceeding with the stack generation.
To skip this validation, you can use the --no-stack-validate flag:
terragrunt stack generate --no-stack-validate
# Refresh sources and regenerate from a clean copy
terragrunt stack generate --source-update
# Or explicitly remove the generated directory first
terragrunt stack clean && terragrunt stack generate
You can also pass --source-update when running commands via stack run:
terragrunt stack run plan --source-update