Setting a Variable Using an Environment Variable

We will learn to set a variable in Terraform using an environment variable.

Another way you can set the value of a variable is by using an environment variable. To do this, set an environment variable in your terminal using the convention TF_VAR_<variable_identifier>.

Click the terminal to run the terraform init command:

Get hands-on with 1200+ tech skills courses.