Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Terraform variable using command line example


If you want to use your own filenaming convention, you can set an alternative tfvars file with the -var-file flag like this (per the linked docs):

$ terraform plan \
-var-file="secret.tfvars" \
-var-file="production.tfvars"
For the CLI, you should quote only the value of the variable, like so:

terraform apply \ 
-var cloudflare_email="service@email.com" \ 
-var cloudflare_token="TOKEN_STRING" \ 
-var do_token="${DO_PAT}"

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)