Skip to main content

Define environment variables

Introduction

Define env vars action is used to define environment variables. Once an environment variable has been defined, it can be accessed both by the blueprint itself as well as any processes (shell scripts, binaries) launched by the blueprint. For instance you can define AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY and then use any AWS actions; AWS's SDK will be able to read the defined environment variables and use them.

Unlike the regular variables, which are enclosed in the blueprint context, environment variables are defined as OS level and they can be used to share information with other processes.

Each environment variable has a name and a value that should be defined in the settings.

Settings

From the settings window we can add environment variables manually or from a file.

Manually

This is the default way. A Name and a Value are required to define the variable. You can also click on the Add new environment variable button in order to add more than one variable.

From file

This is the alternative way to declare environment variables. A a dotenv file with the variables definition is required, for instance:

variable1=value1
variable2=value2
variable3=value3

Once the file has been created and the environment variables have been declared inside it, its path (absolute or relative to CLI's directory) should be used in the settings. Once this action has been reached by the execution flow, the CLI will read the file and declare all environment variables.

Accessing environment variables from the blueprint

Environment variables can be accessed directly from the blueprint by using the global ENV accessor:


For more information about accessing environment variables, please check the Accessing environment variables from blueprints article.