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