O'Reilly logo

Getting Started with Terraform - Second Edition by Kirill Shirinkin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Terraform environment variables

The third way (after interactive input and inline arguments) to supply values to your variables is to use environment variables.

The environment variables are part of the environment where process is running and the program can access them. There are always some environment variables already set; for example, $PATH defines paths where your shell will look for executables. You can get a list of currently set environment variables with the env command on *nix operating systems.

Terraform will automatically read all environment variables with the TF_VAR_ prefix. For example, to set value for the region variable, you would need to set the TF_VAR_region environment variable.

There are multiple ways to set ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required