⚙️ Enhanced Variables Features

Managing variables with Terraform can be quite difficult. Our platform makes it easier to manage those in large scale with some really useful features like variables scope, sensitive variables, variable description and dropdown list.
We've taken this a few steps further by adding native support for HCL and JSON types, and setting variables as required or read only to help manage and protect you terraform deployments.

✨ HCL, JSON, Required and Read only ✨

Using an infrastructure-as-code model, variables are used to customize certain aspects of a configuration for a specific deployment, without having to change the code. In this way, a single configuration can be used in different contexts to create different deployments.

Variables can be anything from ports and IPs to cloud credentials, availability zones, and images.
You can learn more about Variables and Secrets in the env0 platform here


Self hosted agent

If your organization is using the Self hosted agent, please make sure you upgrade to the latest version of the agent to activate those features.
While Required and Read only might work, the HCL and JSON support requires an upgrade.
Learn more on how to upgrade you agent here


Now you can natively configure Terraform variables as HCL or JSON.

{ objects_list = [{ key = "object1" 
                    value = "value1"},
                   { key = "object2" 
                    value = "value2"}] }
["value1", "value2"]
{ "objects_list":  [{ "key": "object1", "value":"value1"},
                    { "key": "object2", "value": "value2"}]}

Required variable

Define your variable as required to verify that this variable has a value before deploying your environment.

Read only variable

Define your variable as a read only to make sure it won't get overridden in lower scopes.

env0 Terraform provider support ®️

Those enhanced variable features are also available in our env0 Terraform provider
You can read more about how to configure variables using the env0_configuration_variable resource


You can set each variable as a HCL/JSON using the format attribute.

Required variable

This can be configured using the is_required attribute.

Read only variable

This can be configured using the is_read_only attribute.

:pencil2: Suggested Blog Content

Terraform Modules Guide

Terraform Plan Examples

Managing Terraform Variable Hierarchy

Manage Terraform Remote State with a Remote Backend