nerdexam
HashiCorp

TA-002-P · Question #354

You want to share Terraform state with your team, store it securely and provide state locking. How would you do this? Choose three correct answers.

The correct answer is A. Using the consul Terraform backend. B. Using the remote Terraform backend with Terraform Cloud / Terraform Enterprise. E. Using an s3 terraform backend with an appropriate IAM policy and dynamodb_field option. To securely share Terraform state with a team and enable state locking, you would typically use a remote backend like Consul, Terraform Cloud/Enterprise, or an S3 backend with DynamoDB for locking.

Implement and maintain state

Question

You want to share Terraform state with your team, store it securely and provide state locking. How would you do this? Choose three correct answers.

Options

  • AUsing the consul Terraform backend.
  • BUsing the remote Terraform backend with Terraform Cloud / Terraform Enterprise.
  • CUsing the local backend.
  • DUsing the s3 terraform backend. The dynamodb_field option e not needed.
  • EUsing an s3 terraform backend with an appropriate IAM policy and dynamodb_field option

How the community answered

(66 responses)
  • A
    74% (49)
  • C
    9% (6)
  • D
    17% (11)

Why each option

To securely share Terraform state with a team and enable state locking, you would typically use a remote backend like Consul, Terraform Cloud/Enterprise, or an S3 backend with DynamoDB for locking.

AUsing the consul Terraform backend.Correct

The Consul backend provides a robust solution for shared state storage and includes built-in state locking capabilities, making it suitable for team environments.

BUsing the remote Terraform backend with Terraform Cloud / Terraform Enterprise.Correct

Terraform Cloud and Terraform Enterprise offer managed remote backends that inherently provide secure, shared state, versioning, and state locking features, ideal for collaborative team workflows.

CUsing the local backend.

The local backend stores the state file on the local filesystem, which is unsuitable for team collaboration, secure sharing, or state locking.

DUsing the s3 terraform backend. The dynamodb_field option e not needed.

An S3 backend alone only provides storage; without a separate locking mechanism like DynamoDB, it does not prevent concurrent state modifications, which is crucial for team environments.

EUsing an s3 terraform backend with an appropriate IAM policy and dynamodb_field optionCorrect

An S3 backend stores the state file in a highly available and durable object storage, and integrating it with DynamoDB (via `dynamodb_table` option, not `dynamodb_field`) provides the necessary state locking mechanism to prevent concurrent state modifications.

Concept tested: Terraform remote backends for shared state and locking

Source: https://developer.hashicorp.com/terraform/language/settings/backends/s3

Topics

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

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice