terragrunt.hcl
to your projectAuto-Init is a feature of Terragrunt that makes it so that terragrunt init
does not need to be called explicitly before other terragrunt commands.
When Auto-Init is enabled (the default), terragrunt will automatically call terraform init
during other commands (e.g. terragrunt plan
) when terragrunt detects that:
terraform init
has never been called, or
source
needs to be downloaded, or
exists file .terragrunt-init-required
in downloaded module directory(.terragrunt-cache/aaa/bbb/modules/<module>
) or
the modules or remote state used by the module have changed since the previous call to terraform init
.
As mentioned, extra_arguments
can be configured to allow customization of the terraform init
command.
Note that there might be cases where terragrunt does not properly detect that terraform init
needs be called. In this case, terraform would fail. Running terragrunt init
again corrects this situation.
For some use cases, it might be desirable to disable Auto-Init. For example, if each user wants to specify a different -plugin-dir
option to terraform init
(and therefore it cannot be put in extra_arguments
). To disable Auto-Init, use the --terragrunt-no-auto-init
command line option or set the TERRAGRUNT_NO_AUTO_INIT
environment variable to true
.
Disabling Auto-Init means that you must explicitly call terragrunt init
prior to any other terragrunt commands for a particular configuration. If Auto-Init is disabled, and terragrunt detects that terraform init
needs to be called, then terragrunt will fail.