Recursively find HashiCorp Configuration Language (HCL) files and rewrite them into a canonical format.
Examples
Recursively format all HCL files in the current directory.
Terminal window
terragrunthclfmt
Flags
--checkoptional(bool)
Enable check mode in the `hcl fmt` command.
When enabled, Terragrunt will check if HCL files are properly formatted without making any changes. This is useful in CI/CD pipelines to ensure consistent formatting.
The command will:
Exit with status code 0 if files are properly formatted
Exit with status code 1 if any files need formatting
Example:
Terminal window
terragrunthclfmt--check
Environment Variables:
TG_CHECK
--diffoptional(bool)
Print diff between original and modified file versions when running `hcl fmt`.
When enabled, Terragrunt will show the differences between the original and formatted versions of HCL files. This helps you understand what changes the formatter would make.
Example:
Terminal window
terragrunthclfmt--diff
Environment Variables:
TG_DIFF
--exclude-diroptional(string)
Skip HCL formatting in given directories.
Specifies directories to exclude from HCL formatting. This is useful when you want to skip formatting certain parts of your codebase.
When enabled, Terragrunt will read HCL content from standard input, format it, and write the result to standard output. This is useful for integrating with text editors or other tools.
With --check or --diff, Terragrunt does not print the formatted content. --check exits with status code 1 when the input needs formatting, and --diff prints a unified diff labeled old/stdin and new/stdin.
Environment Variables:
TG_STDIN
--parallelismoptional(integer)
Parallelism for --all commands.
Sets the maximum number of concurrent unit runs when running commands with --all or --graph. This helps control resource usage and API rate limits when working with multiple units.
By default, there is no limit, and every unit whose dependencies have finished starts immediately.
For details on how runs are scheduled and guidance on choosing a value, see Tuning Parallelism.
Environment Variables:
TG_PARALLELISM
--queue-exclude-diroptional(list(string))
Unix-style glob of directories to exclude from the queue of Units to run.
Environment Variables:
TG_QUEUE_EXCLUDE_DIR
--queue-exclude-externaloptional(bool)
Exclude external dependencies from the queue of Units to run.
Environment Variables:
TG_QUEUE_EXCLUDE_EXTERNAL
--queue-excludes-fileoptional(string, "…")
Path to a file with a list of directories that need to be excluded when running `run --all` commands.
Defaults to .terragrunt-excludes.
Environment Variables:
TG_QUEUE_EXCLUDES_FILE
--queue-ignore-dag-orderoptional(bool)
Ignore DAG order for --all commands.
When enabled, Terragrunt will ignore the dependency order when running commands with --all. This means units will be executed in arbitrary order, which can be useful for read-only operations like plan.
Note that this can lead to errors if used with commands that modify state, as dependencies might be processed in the wrong order.
To learn more about how to use this flag, see the Stacks feature documentation.
Environment Variables:
TG_QUEUE_IGNORE_DAG_ORDER
--queue-ignore-errorsoptional(bool)
Continue processing Units even if a dependency fails.
When enabled, Terragrunt will continue processing remaining units even if one fails. This can be useful when you want to see all potential errors in your configuration, rather than stopping at the first failure.
Note that this may lead to incomplete or inconsistent states if used with commands that modify infrastructure.
To learn more about how to use this flag, see the Stacks feature documentation.
Environment Variables:
TG_QUEUE_IGNORE_ERRORS
--queue-include-diroptional(list(string))
Unix-style glob of directories to include in the queue of Units to run.
Environment Variables:
TG_QUEUE_INCLUDE_DIR
--queue-include-externaloptional(bool)
Include external dependencies in the queue of Units to run.
Environment Variables:
TG_QUEUE_INCLUDE_EXTERNAL
--queue-include-units-readingoptional(string)
If flag is set, 'run --all' will only run the command against Terragrunt units that read the specified file via an HCL function or include.
Environment Variables:
TG_QUEUE_INCLUDE_UNITS_READING
--queue-strict-includeoptional(bool)
Only process the directories matched by --queue-include-dir.