What is a .tfvars file?
text/x-terraform
A .tfvars file supplies values for the variables a Terraform configuration declares. It uses the same HCL grammar but permits only top-level `name = value` assignments — strings, numbers, booleans, lists, and objects — with no blocks or expressions. Files named terraform.tfvars or *.auto.tfvars are loaded automatically; others must be passed explicitly.
How to use a .tfvars file
Use an example .tfvars file to test variable-file parsers and configuration tooling, verifying type coercion, complex object and list values, and that assignment precedence between auto-loaded, explicit, and environment-supplied values is applied correctly.
Download example .tfvars files
- Terraform Default terraform.tfvarsA terraform.tfvars assigning the staging defaults, including a nested map-of-objects value. Pairs with the production overrides file, which replaces that map wholesale rather than merging into it.
- Terraform Production tfvars OverridesThe production tfvars overrides. Its point is a semantic that surprises people: a complex-typed variable is replaced whole, not deep-merged, so the staging app-b subnet does not survive the override.