Overview
When creating or editing a template, you can specify which version of Infrastructure as Code (IaC) tools to use for your deployments. env zero supports version management for Terraform, OpenTofu, Terragrunt, Pulumi, and Ansible.Version Resolution Order
When determining which version to use, env zero follows this priority order:- Environment Variables (
ENV0_TOOL_VERSIONEnvironment Variable) - Version Files (per-tool repository files such as
.terraform-version) - Template Settings (Specified in UI)
Version Specification Methods
1. Environment Variables
You can override the template version setting using environment variables:
For Terraform, env zero also accepts
ENV0_TF_VERSION as a legacy alias. If both are set, ENV0_TERRAFORM_VERSION takes precedence.
2. Version Files
env zero can automatically detect versions from standard version files located under the directory you configure in the template. If you want to reuse the same version files for multiple folders, set the environment variable ENV0_RESOLVE_FILE_VERSION_RECURSIVELY=true.3. Template Settings
To associate a specific IaC version with a template:- Open the relevant Template.
- Go to the Settings tab and expand Advanced Settings.
- Select the desired version from the
"Template Type" Versiondropdown. - Click Save.

Special Version Values
Version from code
For Terraform and OpenTofu, env zero can install a version that therequired_version constraint in your code allows. The version dropdown offers Resolve from terraform code - newest allowed and Resolve from terraform code - lowest allowed. OpenTofu templates show opentofu code in place of terraform code.
New templates you create in the UI use newest allowed. Existing templates keep their setting until you change it.
Newest allowed reads
~> the way Terraform and OpenTofu do, so only the rightmost version number in the constraint can increase:
~> 1.13allows any 1.x release from 1.13.0, so env zero installs the newest 1.x release.~> 1.13.0allows 1.13.x releases only, so env zero installs the newest 1.13 patch.
For self-hosted agents: agents older than 4.0.45 install the latest version in place of the newest allowed one.

Latest Version
You can specify “latest” for supported IaC tools:- Terraform: Latest version up to 1.5.x
- Pulumi: Latest available version
- OpenTofu: Latest available version
- Ansible: Latest available version
The version value for automatic detection is
latest.Next steps
- Switch a template to OpenTofu
- Set other deployment controls through environment variables