⚠️ Alpha Release
Terragrunt CLI configuration file
Config path
The path to the file can be specified using CLI arg --cli-config-file
(hidden) or env var TG_CLI_CONFIG_FILE
.
If the path is not specified explicitly, it tries to find in the following directories:
- In the specified TG working directory.
- In the repository root directory.
- In
.config
located in the repository root directory. - In config dirs, depending on the OS, for unix OS this may be
HOME
orXDG_CONFIG_HOME/terragrunt
directory.
For unix OS, the default file name is .terragruntrc.json
, for Windows is terragruntrc.json
.
Config keys and values
Configuration values have the lowest priority compared to CLI args and Env vars, and are thus overwritten when CLI args or env vars are explicitly specified.
The name of the key-values corresponds to the name of their flags, but with some exceptions for some of them. Global flags and flags belong to the run
command have the same keys as their CLI args, but for others you need to prepend the name of their commands. For example:
- The key for the
terragrunt --log-level
flag islog-level
- The key for the
terragrunt run --tf-forward-stdout
flag istf-forward-stdout
- The key for the
terragrunt list --format
flag islist-format
- The key for the
terragrunt hcl format --exclude-dir
flag ishcl-format-exclude-dir
The key names are case insensitive. You can also use _
in keys instead of -
. For example: hcl-format-exclude-dir
is equivalent to HCL-Format-exclude_diR
If a non-existent key is specified, a warning is be displayed. Log example:
WARN CLI configuration file contains unused keys: nooon_interactive
Configuration value validation is the same as CLI args validation. Log example:
ERROR Could not apply CLI config: invalid value "infoooo" for key "log-level": invalid level "infoooo", supported levels: stderr, stdout, error, warn, info, debug, trace
Debugging
Logging at level debug
outputs information indicating where the flag value was taken from. This way you can understand what value is used for the flag if the same flag was set in different places: cli-config, env-var or cli-args. Log example:
DEBUG Using cli-config "tf-path=tofu"
DEBUG Using cli-config "strict-control=[spin-up tear-down]"
DEBUG Using evn-var "TG_LOG_LEVEL=trace"
DEBUG Using evn-var "TG_NON_INTERACTIVE=true"
DEBUG Using cli-argument "working-dir=/path/to/working/dir"