HashiCorp Certified: Terraform Associate — Question 162
Define the purpose of state in Terraform.
Answer options
- A. State stores variables and lets you quickly reuse existing code
- B. State lets you enforce resource configurations that relate to compliance policies
- C. State codifies the dependencies of related resources
- D. State maps real world resources to your configuration and keeps track of metadata
Correct answer: D
Explanation
The correct answer is D because Terraform's state file is essential for mapping real-world infrastructure to the configuration and storing important metadata. Options A, B, and C describe aspects of resource management but do not accurately capture the primary purpose of state in Terraform, which is to track the resources and their metadata.