In what order does Terraform load variable values?
BeginnerConceptVariables, Locals, Outputs and Types
Answer
From lowest to highest precedence: defaults, environment variables (TF_VAR_), terraform.tfvars, terraform.tfvars.json, *.auto.tfvars and *.auto.tfvars.json (alphabetical), then -var and -var-file in the order given on the command line. Later wins. In HCP Terraform, workspace variables slot in between.
More on Variables, Locals, Outputs and Types
How do you declare an input variable?BeginnerHow do you define an output and what is it for?BeginnerWhat is the difference between locals and variables?BeginnerWhat are the primitive types in Terraform?BeginnerHow do list, set and map differ?IntermediateWhat are `object` and `tuple` types?Intermediate