nerdexam
HashiCorp

TA-002-P · Question #419

Changing the Terraform backend from the default "local" backend to a different one after doing your first terraform apply is:

The correct answer is B. Optional. Migrating from the local backend to a remote backend after an initial apply is optional - Terraform supports backend changes at any time by migrating existing state.

Implement and maintain state

Question

Changing the Terraform backend from the default "local" backend to a different one after doing your first terraform apply is:

Options

  • AMandatory
  • BOptional
  • CImpossible
  • DDiscouraged

How the community answered

(36 responses)
  • A
    3% (1)
  • B
    94% (34)
  • C
    3% (1)

Why each option

Migrating from the local backend to a remote backend after an initial apply is optional - Terraform supports backend changes at any time by migrating existing state.

AMandatory

Mandatory is incorrect; many valid workflows use the local backend throughout a project's lifetime, particularly for personal or single-user projects.

BOptionalCorrect

Terraform allows you to change the backend configuration after infrastructure has already been provisioned. Running terraform init after updating the backend block prompts Terraform to migrate the existing state to the new backend, making the switch optional and reversible rather than mandatory, impossible, or discouraged.

CImpossible

Impossible is incorrect; terraform init handles state migration when the backend block is changed, making the transition straightforward.

DDiscouraged

Discouraged is incorrect; migrating to a remote backend is actually encouraged as a best practice for collaboration, not something to avoid.

Concept tested: Changing Terraform backend after initial apply

Source: https://developer.hashicorp.com/terraform/language/settings/backends/configuration#changing-backend-configuration

Topics

#Terraform backend#State management#State migration

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice