HashiCorp Certified: Terraform Associate — Question 120
Define the purpose of state in Terraform.
Answer options
- A. State is used to map real world resources to your configuration and keep track of metadata
- B. State is a method of codifying the dependencies of related resources
- C. State is used to enforce resource configurations that relate to compliance policies
- D. State is used to store variables and quickly reuse existing code
Correct answer: A
Explanation
The correct answer is A because state in Terraform is crucial for mapping real-world resources to the configuration and keeping track of metadata related to those resources. Options B, C, and D describe other functions that are not the primary purpose of state in Terraform, such as dependency management, compliance configuration, and code reuse, respectively.