-var

The plan and apply option that sets one input variable on the command line, as in -var="environment=prod".

In more detail

Command-line values beat every other source. It is handy for a one-off experiment, but a long command line is not version-controlled, so real projects use .tfvars files.

Example

terraform plan -var="environment=prod"

Related terms

Taught in

References

Certification courses