nerdexam
HashiCorp

TA-002-P · Question #51

Where in your Terraform configuration do you specify a state backend?

The correct answer is A. The terraform block. The state backend is configured inside the terraform block using a nested backend block. For example: terraform { backend "s3" { bucket = "my-bucket" } }. The terraform block is specifically reserved for Terraform's own settings, including required providers, required Terraform v

Implement and maintain state

Question

Where in your Terraform configuration do you specify a state backend?

Options

  • AThe terraform block
  • BThe resource block
  • CThe provider block
  • DThe datasource block

How the community answered

(34 responses)
  • A
    88% (30)
  • B
    3% (1)
  • C
    3% (1)
  • D
    6% (2)

Explanation

The state backend is configured inside the terraform block using a nested backend block. For example: terraform { backend "s3" { bucket = "my-bucket" } }. The terraform block is specifically reserved for Terraform's own settings, including required providers, required Terraform versions, and backend configuration. Resource blocks define infrastructure, provider blocks configure providers, and data source blocks read existing infrastructure - none of these are the correct location for backend configuration.

Topics

#state backend#terraform block#configuration structure#remote state

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice