terragrunt

Terragrunt CLI

Subcommands

NameDescription
initPrepare your working directory for other commands
validateCheck whether the configuration is valid
planShow changes required by the current configuration
applyCreate or update infrastructure
destroyDestroy previously-created infrastructure
consoleTry Terraform expressions at an interactive command prompt
fmtReformat your configuration in the standard style
force-unlockRelease a stuck lock on the current workspace
getInstall or upgrade remote Terraform modules
graphGenerate a Graphviz graph of the steps in an operation
importAssociate existing infrastructure with a Terraform resource
loginObtain and save credentials for a remote hos
logoutRemove locally-stored credentials for a remote host
outputShow output values from your root module
providersShow the providers required for this configuration
refreshUpdate the state to match remote systems
showShow the current state or a saved plan
stateAdvanced state management
taintMark a resource instance as not fully functional
untaintRemove the 'tainted' state from a resource instance
workspaceWorkspace management
run-allRun a terraform command against a 'stack' by running the specified command in each subfolder. E.g., to run 'terragrunt apply' in each subfolder, use 'terragrunt run-all apply'
terragrunt-infoEmits limited terragrunt state on stdout and exits
validate-inputsChecks if the terragrunt configured inputs align with the terraform defined variables
graph-dependenciesPrints the terragrunt dependency graph to stdout
hclfmtRecursively find hcl files and rewrite them into a canonical format
aws-provider-patchOverwrite settings on nested AWS providers to work around a Terraform bug (issue #13018)
render-jsonRender the final terragrunt config, with all variables, includes, and functions resolved, as json. This is useful for enforcing policies using static analysis tools like Open Policy Agent, or for debugging your terragrunt config

Options

NameDescription
-h, --helpShow this help output, or the help for a specified subcommand
-v, --versionShow the current Terragrunt version
--terragrunt-config <arg>Path to the Terragrunt config file. Default is terragrunt.hcl
--terragrunt-tfpath <arg>Path to the Terraform binary. Default is terraform (on PATH)
--terragrunt-no-auto-initDon't automatically run 'terraform init' during other terragrunt commands. You must run 'terragrunt init' manually
--terragrunt-no-auto-retryDon't automatically re-run command in case of transient errors
--terragrunt-non-interactiveAssume 'yes' for all prompts
--terragrunt-working-dir <arg>The path to the Terraform templates. Default is current directory
--terragrunt-download-dir <arg>The path where to download Terraform code. Default is .terragrunt-cache in the working directory
--terragrunt-source <arg>Download Terraform configurations from the specified source into a temporary folder, and run Terraform in that temporary folder
--terragrunt-source-mapReplaces any source URL (including the source URL of a config pulled in with dependency blocks) that has root source with dest
--terragrunt-source-updateDelete the contents of the temporary folder to clear out any old, cached source code before downloading new source code into it
--terragrunt-ignore-dependency-errors*-all commands continue processing components even if a dependency fails
--terragrunt-iam-role <IAM role ARN>Assume the specified IAM role before executing Terraform. Can also be set via the TERRAGRUNT_IAM_ROLE environment variable
--terragrunt-iam-assume-role-duration <Duration>Session duration for IAM Assume Role session. Can also be set via the TERRAGRUNT_IAM_ASSUME_ROLE_DURATION environment variable
--terragrunt-iam-assume-role-session-name <Session name>Name for the IAM Assummed Role session. Can also be set via TERRAGRUNT_IAM_ASSUME_ROLE_SESSION_NAME environment variable
--terragrunt-exclude-dir <arg>Unix-style glob of directories to exclude when running *-all commands
--terragrunt-include-dir <arg>Unix-style glob of directories to include when running *-all commands
--terragrunt-strict-includeOnly modules under the directories passed in with –terragrunt-include-dir will be included. All dependencies of the included directories will be excluded if they are not in the included directories. If no –terragrunt-include-dir flags are included, terragrunt will not include any modules during the execution of the commands
--terragrunt-strict-validateSets strict mode for the validate-inputs command. By default, strict mode is off. When this flag is passed, strict mode is turned on. When strict mode is turned off, the validate-inputs command will only return an error if required inputs are missing from all input sources (env vars, var files, etc). When strict mode is turned on, an error will be returned if required inputs are missing OR if unused variables are passed to Terragrunt
--terragrunt-ignore-dependency-order*-all commands will be run disregarding the dependencies
--terragrunt-ignore-external-dependencies*-all commands will not attempt to include external dependencies
--terragrunt-include-external-dependencies*-all commands will include external dependencies
--terragrunt-parallelism <N>*-all commands parallelism set to at most N modules
--terragrunt-debugWrite terragrunt-debug.tfvars to working folder to help root-cause issues
--terragrunt-log-levelSets the logging level for Terragrunt. Supported levels: panic, fatal, error, warn (default), info, debug, trace
--terragrunt-checkEnable check mode in the hclfmt command
--terragrunt-hclfmt-file <hcl file>The path to a single hcl file that the hclfmt command should run on
--terragrunt-override-attr <arg>A key=value attribute to override in a provider block as part of the aws-provider-patch command. May be specified multiple times
--terragrunt-json-out <arg>The file path that terragrunt should use when rendering the terragrunt.hcl config as json. Only used in the render-json command. Defaults to terragrunt_rendered.json
--terragrunt-modules-that-include <arg>When passed in, run-all will only run the command against Terragrunt modules that include the specified file