Terragrunt is a thin wrapper that provides extra tools for keeping your configurations “Don’t Repeat Yourself” (DRY), working with multiple Terraform modules, and managing remote states.
Within Terragrunt template configuration, under
Advanced settings - check
Execute run-all commands on multiple modules
run-allto each command, read more here.
- Supported from version 0.28.1.
Local Terraform State
By default, env0 stores the local state for next deployments.
In some cases, we will not be able to store the local state for your Terragrunt modules. Please configure a remote backend with your Terragrunt code Remote terraform code, otherwise your Terragrunt code may not work properly with env0.
env0's Terraform deployment flow includes a
planstep and an
applystep that uses the plan's results (plan file/s) to ensure every change is aligned between both steps.
According to the official docs, the
run-all plan -out=/path/to/plan-filecommand we use will fail if there are yet-to-be-applied dependencies between modules. It will only output some of the expected plan files. This leads to the failure of the
run-all apply /path/to/plan-filecommand that is being executed next, since it expects all modules to have plan files.
As a workaround, we expose the
ENV0_OMIT_TERRAGRUNT_RUN_ALL_PLAN_FILEenvironment variable. Simply set it's value to
trueand deploy. The
run-all applycommands will be executed without passing plan files between them. This is risky and should only be done on initial deployment. On success, it is advised to remove this environment variable in order to keep the
env0 supports terragrunt include dir , which is a CLI Arg for Terragrunt environment that runs in a
run-all mode by using environment variable
ENV0_TERRAGRUNT_RUN_ALL_INCLUDE_DIRS. Terragrunt will plan and apply only those modules and their dependencies when you use this variable.
Updated 2 months ago