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
--check
Enable check mode in the hclfmt 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
Type: bool
Environment Variables:
TG_CHECK
--diff
Print diff between original and modified file versions when running with 'hclfmt'.
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
Type: bool
Environment Variables:
TG_DIFF
--exclude-dir
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.
Sets the maximum number of concurrent operations when running commands with --all. This helps control resource usage and API rate limits when working with multiple units.
Type: integer
Environment Variables:
TG_PARALLELISM
--queue-exclude-dir
Unix-style glob of directories to exclude from the queue of Units to run.
Type: list(string)
Environment Variables:
TG_QUEUE_EXCLUDE_DIR
--queue-exclude-external
Exclude external dependencies from the queue of Units to run.
Type: bool
Environment Variables:
TG_QUEUE_EXCLUDE_EXTERNAL
--queue-excludes-file
Path to a file with a list of directories that need to be excluded when running `run --all` commands.
Type: string
Default: .terragrunt-excludes
Environment Variables:
TG_QUEUE_EXCLUDES_FILE
--queue-ignore-dag-order
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.
Type: bool
Environment Variables:
TG_QUEUE_IGNORE_DAG_ORDER
--queue-ignore-errors
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.
Type: bool
Environment Variables:
TG_QUEUE_IGNORE_ERRORS
--queue-include-dir
Unix-style glob of directories to include in the queue of Units to run.
Type: list(string)
Environment Variables:
TG_QUEUE_INCLUDE_DIR
--queue-include-external
Include external dependencies in the queue of Units to run.
Type: bool
Environment Variables:
TG_QUEUE_INCLUDE_EXTERNAL
--queue-include-units-reading
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.
Type: string
Environment Variables:
TG_QUEUE_INCLUDE_UNITS_READING
--queue-strict-include
Only process the directories matched by --queue-include-dir.