Terraform variables file (.tfvars)

A .tfvars file sets values for the input variables declared in a Terraform configuration. It separates configuration from environment-specific values, so the same code can deploy to development, staging and production with different settings, such as instance sizes or region names.

Terraform loads terraform.tfvars and any *.auto.tfvars files automatically. Other files are passed with -var-file=prod.tfvars. Variables themselves are declared in a variables.tf file with a type, description and optional default.

Keep secrets out of .tfvars files that are committed to Git. Use environment variables (TF_VAR_name) or a secrets manager instead, and mark sensitive variables with sensitive = true.