Import Variable Plugin

Fetch output values from another environment and insert them as terraform variables.


This plugin executes a script to help you fetch output variables from other environments to use as input variables for your current environment.

For more information, check out the Import Variable Plugin git repository.


To use this plugin, you need to setup the env0 API key and secret for the environment. You can use an Organization API Key or a Personal API Key.

  1. ENV0_API_KEY (Required)
  2. ENV0_API_SECRET (Required)


Add the following env0.yaml custom flow file to your environment or project.

version: 2  
        - name: Import Variables
  1. Configure the Custom Flow above with a new environment or an existing environment
  2. Add a Terraform Variable
  3. The Key is the name of your Terraform variable
  4. The Value is a reference to another environment's output variable. With the following format: ${env0:<env0_environment_id>:<output_key>}
  5. Run the environment, and env0 will fetch the value


For example, if I needed the VPC ID from my "Dev VPC" Environment:

  1. First I need to get the ENV0_ENVIRONMENT_ID from that environment. note: the Environment ID can be found in the URL. For example, given this URL 9cec1eb6-c17f-4cca-9cdf-606a23cdf6b5 is the ENV0_ENVIRONMENT_ID.
  2. Find the output name you want to use in the environment resources tab. e.g. vpc_id
  3. The value you enter would be: ${env0:9cec1eb6-c17f-4cca-9cdf-606a23cdf6b5:vpc_id}