nerdexam
HashiCorp

TA-002-P · Question #189

When using Terraform in a team it is important for everyone to be working with the same state so that operations will be applied to the same remote objects. Which of the below option is a…

The correct answer is A. Remote State. Remote state stores the Terraform state file in a shared centralized backend so all team members reference the same source of truth, enabling consistent operations and state locking to prevent conflicts.

Implement and maintain state

Question

When using Terraform in a team it is important for everyone to be working with the same state so that operations will be applied to the same remote objects. Which of the below option is a recommended solution for this?

Options

  • ARemote State
  • BModule
  • CUse the cached state and treat this as the record of truth.
  • DWorkspace

How the community answered

(33 responses)
  • A
    91% (30)
  • B
    3% (1)
  • D
    6% (2)

Why each option

Remote state stores the Terraform state file in a shared centralized backend so all team members reference the same source of truth, enabling consistent operations and state locking to prevent conflicts.

ARemote StateCorrect

Remote state backends such as Terraform Cloud, AWS S3, or Azure Blob Storage host the state file in a location accessible to every team member, ensuring that all plans and applies operate on identical state data and that state locking prevents simultaneous writes from causing corruption.

BModule

Modules are reusable configuration abstractions and have no mechanism for sharing or synchronizing state data between team members.

CUse the cached state and treat this as the record of truth.

Using locally cached state in a team environment is dangerous because different developers may have stale or divergent copies, leading to unintended overwrites or missed infrastructure changes.

DWorkspace

Workspaces allow multiple isolated state instances within a single backend but do not themselves solve the problem of sharing a single consistent state among collaborators - remote state storage is still required.

Concept tested: Terraform remote state backend for team state sharing

Source: https://developer.hashicorp.com/terraform/language/state/remote

Topics

#Terraform state#Remote state#Team collaboration#State management

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice