Running Terragrunt with OpenTofu / Terraform
The env zero platform supports running Terragrunt with either OpenTofu or Terraform. By default the selected TF binary is OpenTofu. In order to change that, you should open theAdvanced
settings and select which TF binary to use:

Run-all Terragrunt command checkbox
Within Terragrunt template configuration, underAdvanced
settings - check Execute run-all commands on multiple modules
- Adds
run-all
to each command, read more here. - Supported from version 0.28.1.
Local Terraform StateBy default, env zero 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 env zero.
Cross-Module Dependenciesenv zero’s Terraform deployment flow includes a
plan
step and an apply
step 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-file
command 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-file
command that is being executed next, since it expects all modules to have plan files.As a workaround, we expose the ENV0_TERRAGRUNT_RUN_ALL_SKIP_PLAN
environment variable. Simply set its value to true
and deploy. The run-all apply
command will be executed without running the plan. 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 plan
and apply
steps in-sync.Enabling ENV0_TERRAGRUNT_RUN_ALL_SKIP_PLAN requires the deployment to be configured with auto-approval. When this variable is set to true, both the plan and cost estimation steps are skipped, and their statuses will be marked as “warning” to indicate reduced visibility and governance. The deployment will proceed directly to apply. If this flag is used in a deployment that requires approval, the step - and consequently the entire deployment - will fail.Target modules
env zero supports terragrunt include dir , which is a CLI Arg for Terragrunt environment that runs in arun-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.
Example:
ENV0_TERRAGRUNT_RUN_ALL_INCLUDE_DIRS=module1,path_to_module/module2
Smart detect Terragrunt modules changes
If you useTerragrunt run all
PR Plan feature you can use our plugin for running plan only for changed modules in the PR
Troubleshooting
There is a known issue withterragrunt run-all plan -destroy -out=.tf-plan
generating an incorrectly ordered graph. Thus, if you have dependency issues with run-all destroy, please use ENV0_TERRAGRUNT_RUN_ALL_SKIP_PLAN=true
in your pipeline to skip the plan step. Make sure to enable “Approve Plan Automatically”.