Rationale for Correct Answer (B):Terraform uses a state file to map real-world resources to your configuration. By default, if no backend is explicitly defined, Terraform stores this information in a file named terraform.tfstate located in the same directory as your configuration files. This local state file is critical for Terraform to understand what infrastructure already exists and to plan updates correctly.
Analysis of Incorrect Options (Distractors):
A. .terraform.d (home directory subdirectory):This is used for storing plugins and some global settings, not for resource state.
C. .terraform.lock.hcl (lock file):This file locks provider versions to ensure reproducible runs, but it does not contain resource state information.
D. .terraform (subdirectory):This folder contains cached provider binaries and related data, but not the actual state file.
Key Concept:Terraform state management is at the core of "Implement and Maintain State." Understanding where Terraform stores the state by default is critical because state files should often be stored remotely (using a backend like S3, GCS, or Terraform Cloud) for collaboration and reliability.
[Reference:Terraform Exam Objective – Implement and Maintain State (HashiCorp Certified: Terraform Associate)., , , ]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit