Using Terraform CLI, how do you pass variable value when you execute terraform plan command?

Experience Level: Junior
Tags: Terraform

Answer

There are two options. You can either provide variables with values as command arguments or you can store them to variable file.

Option 1:

Run the following command:

terraform plan -var 'foo=bar' -var 'abc=def'

Option 2:

Run the following command:

terraform plan -var-file=filename

Comments

No Comments Yet.
Be the first to tell us what you think.
Terraform CLI
Terraform CLI

Are you learning Terraform ? Try our test we designed to help you progress faster.

Test yourself