Skip to main content
Variable Sets offer a convenient solution for organizing frequently used or closely related variables into cohesive groups. These groups can then be linked to an entire Organization or to specific Projects, Templates, Workflows, or Environments that require access to their values. Overall, Variable Sets can be used to store an important configuration as a single unit. For instance, you might create a Set named “RDS Settings,” encompassing the default and commonly used values of your RDS instances and assign it to all of the environments that manage RDS instances. This approach ensures variables are defined once and utilized only where needed, promoting efficiency and consistency across your workflows.

View Variables Sets

Variable Sets can be defined within one of two scopes:
  • Organization: Sets created at this level are available for assignment to any entity within env zero, including that same Organization or all Projects, Templates, Workflows, and Environments.
  • Project: Sets created within a specific Project can be assigned to any sub-entity of that Project, such as sub Projects, Workflows, or Environments.
To view your Variable Sets, navigate to the ‘Variables’ section in the navigation menu, either within the Organization or Project context, and then click on the ‘SETS’ tab. Variable Sets list in the SETS tab showing existing sets within the organization or project context

Create a Variable Set

Variable Sets can be created on two scopes: Organization and Project. To create a new Variable Set, follow these steps: Click on the ‘CREATE NEW SET’ button located in the upper right corner. This action will open a modal window. In the modal window, proceed through two steps:
  1. Define the Set’s name and provide an optional description.
  2. Define the variables within the Set.
Create Variable Set modal with fields for set name, description, and variable definitions

Assign a Variable Set

Assigning a Variable Set can be done on multiple levels – Organization/Project/Template/Workflow/Environment. The variables table for any of the mentioned entities contains a selector that allows you to mark the sets you would like to use. Variables table with a Variable Set selector showing sets available to assign to this entity

Override Set’s Variables

Similar to any other variable in env zero, you can override the variables within a Variable Set. Variable set with an overridden variable value shown inline in the variables table

Precedence and conflicts

A variable set ranks at the scope it’s assigned to, not the scope it was created in. A set assigned to a project ranks as a project variable, and a set assigned to an environment ranks as an environment variable. For the order of scopes, see Precedence across scopes. Within one scope, a variable defined directly on the scope wins over the same variable from a set assigned to that scope. To override a value that comes from a set, set the variable directly on the environment. Overriding with a second set doesn’t work, because two sets can’t define the same variable (see Same variable in two sets). The only set variables you can’t override are read-only ones. Mark a variable as read-only when lower scopes must not change it.

Example

An organization admin assigns the set platform-baseline to the organization. A project and an environment then set some of the same variables directly:
  • instance_type: the environment is the most specific scope, so its value wins.
  • cost_center: the set marks it read-only, so the environment’s value is ignored.
If you then assign payments-prod a second set that also defines instance_type, env zero rejects the assignment, because platform-baseline already defines it.

Same variable in two sets

Two variable sets that apply to the same environment can’t define a variable with the same name and type. A Terraform variable and an environment variable with the same name don’t conflict.
  • When you assign a set, env zero rejects the assignment with Set has conflicts with already assigned configurations if a set already assigned to that scope or a higher scope defines the same variable.
  • When you assign two sets in the same save and they define the same variable, env zero rejects it with A Set has conflicts with another assigned set.
  • If conflicting sets still apply to an environment, for example because a variable was added to a set after it was assigned, the deployment fails with Configuration properties with the same name and type are not allowed. Setting the variable directly on the environment doesn’t resolve this.
To fix a conflict, rename the variable in one of the sets, or keep the variable in one set and remove it from the other.

Coming from Terraform Cloud

Variable sets in HCP Terraform (Terraform Cloud) resolve some cases differently:
  • HCP Terraform allows two variable sets at the same level to define the same variable, and uses the value from the set whose name sorts first. env zero rejects the assignment or fails the deployment instead.
  • HCP Terraform priority variable sets override workspace variables. env zero has no priority sets. To stop lower scopes from overriding a value, mark the variable as read-only.
  • In HCP Terraform, a variable defined directly on the workspace wins over non-priority variable sets. In env zero, a variable defined directly on the environment wins over variable sets, unless a set or a higher scope marks the variable as read-only.

Next steps