HashiCorp Terraform Associate (004) Question 162
Single answer6a Describe the local backendA small team is building a proof-of-concept with Terraform on a single developer workstation. They have not configured any backend block in their root module. After several successful applies, a teammate asks where Terraform is storing the current infrastructure state and whether multiple team members can safely share it as-is. Which statement best answers both concerns?
- A
Terraform is using the local backend by default, storing state in a local file such as terraform.tfstate on disk, and this setup is not appropriate for concurrent team sharing without additional coordination.
- B
Terraform is using the local backend by default, storing state in Terraform Cloud automatically, which makes it safe for multiple users to run applies at the same time.
- C
Terraform is using an in-memory backend until a backend block is added, so no persistent state exists yet and each apply recalculates everything from the providers.
- D
Terraform is using the remote backend by default, storing state under the .terraform directory, which provides built-in locking for team collaboration.
Show answer and explanation
Correct answer: A
Explanation
This question tests practical understanding of the local backend in a realistic early-stage project. In Terraform, if you do not configure a backend, Terraform uses the local backend by default. The local backend stores state on the local filesystem, commonly in terraform.tfstate. This is acceptable for individual use or simple experimentation, but it creates collaboration risks in team environments because the state file is not centrally shared and does not provide the robust locking and consistency controls expected from many remote backends. HashiCorp documentation for backends and state management emphasizes that local state is the default behavior and that remote backends are preferred for team workflows because they enable shared access and, depending on the backend, state locking and better operational safety.
- A. Correct.
Correct. If no backend is configured, Terraform uses the local backend by default. The local backend stores state locally, typically in a file named terraform.tfstate in the working directory unless otherwise configured. This is workable for a single user or simple local workflows, but it is not ideal for team use because the state is tied to a local machine and does not provide the collaboration and locking features commonly associated with remote backends.
- B. Incorrect.
Incorrect. Terraform does not automatically use Terraform Cloud or any other remote service unless it is explicitly configured. This option reflects a common misconception that state is centrally managed by default. In reality, without backend configuration, state remains local to the machine running Terraform.
- C. Incorrect.
Incorrect. Terraform state is persistent by default when using the local backend. It is not kept only in memory. Terraform writes state to disk so it can track real infrastructure between runs. If state were only in memory, Terraform would be unable to perform reliable plans and applies across separate executions.
- D. Incorrect.
Incorrect. The remote backend is not the default. Also, the .terraform directory is used for local working data such as downloaded providers and modules, not as the default location for managed remote state. Built-in state locking depends on the specific backend being used, and the local backend does not provide remote-style shared locking for team collaboration.