TERRAFORM-ASSOCIATE-003 practice question 2 of 30
[Navigate Terraform State and Backends] Terraform variable names are saved in the state file.
Full set: 226 questionsThe Terraform state file does not store the names of the input variables defined in your configuration (.tf files). Instead, it stores the values that are assigned to resource attributes, which may have originated from variables. The state file's primary purpose is to map the configured resources to real-world objects and to cache the attribute values of those resources. The configuration logic, including variable names, resides solely in the .tf configuration files.
The statement is False. The state file is a record of the state of your infrastructure, not a copy of the code used to create it. For example, if you have a variable var.instancesize with a value of "t2.micro" and use it to set an EC2 instance's instancetype, the state file will record "instancetype": "t2.micro", but it will not contain any reference to the variable name instancesize.
1. HashiCorp Developer Documentation
"Purpose of Terraform State": This document explains that the state file is used for "Mapping to Real World"
"Metadata"
and "Performance". It emphasizes that the state stores "attribute values for all resources
" which are the resolved values
not the variable names from the configuration. The document makes no mention of storing variable names.
Source: HashiCorp
"Purpose of Terraform State"
https://developer.hashicorp.com/terraform/language/state/purpose
2. HashiCorp Developer Documentation
"State File Format": This technical reference details the JSON structure of the state file. The schema includes objects for resources and their instances
which contain an attributes map. This map holds the key-value pairs of the resource's arguments and their final
computed values. The schema does not include any fields for storing the names of the input variables used to derive these values.
Source: HashiCorp
"State File Format"
https://developer.hashicorp.com/terraform/language/state/format
Keep practicing
Take the free TERRAFORM-ASSOCIATE-003 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other TERRAFORM-ASSOCIATE-003 practice questions
- Question 1[Understand Terraform Basics and CLI] If you update the version constraint in your Terraf…
- Question 3[Understand Terraform Basics and CLI] You modified your Terraform configuration and run T…
- Question 4[Understand Terraform Basics and CLI] You must use different Terraform commands depending…
- Question 6[Understand Terraform Basics and CLI] terraform init creates an example main.tf file in t…
- Question 7[Understand Terraform Basics and CLI] terraform validate confirms that your infrastructur…
- Question 8[Interact with Terraform Modules] All modules published on the official Terraform Module …
