variable definitions file
A .tfvars file of name = value lines that supplies values for input variables.
In more detail
terraform.tfvars and any *.auto.tfvars files are loaded automatically; other files are named with -var-file. Because they are committed, they must never hold secrets.
Example
environment = "staging"
instance_count = 4Related terms
- input variable — A named, typed value a configuration or module takes from outside, declared in a variable block and read as var.<name>.
- Terraform variable precedence — The fixed order Terraform uses to decide which value wins when a variable is set in more than one place.
- -var — The plan and apply option that sets one input variable on the command line, as in -var="environment=prod".
Taught in
- Parameterising With Input Variables — Infrastructure as Code with Terraform
- Input Variables, Outputs, And Which Value Wins — HashiCorp Terraform Associate (004) Exam Prep
- Complex Types: Lists, Sets, Maps, Objects And Tuples — HashiCorp Terraform Associate (004) Exam Prep
- Sensitive Data, Ephemeral Values And Secrets From Vault — HashiCorp Terraform Associate (004) Exam Prep
- Module Versions: Pin, Upgrade, Re-Initialise — HashiCorp Terraform Associate (004) Exam Prep
- HCP Workspaces, Projects And Variable Sets: Which Value Wins? — HashiCorp Terraform Associate (004) Exam Prep
- The Full Mock: Sixty Minutes, Eight Areas, One Plan For The Last Week — HashiCorp Terraform Associate (004) Exam Prep