QuestionQ72

Terraform state management

Which Terraform command always triggers a state-file update for changes that may have occurred outside Terraform?

  • A terraform plan -refresh-only
  • B terraform show -json
  • C terraform apply =lock=false
  • D terraform plan -target=state
Explanation

terraform plan -refresh-only runs Terraform in refresh-only mode, which compares remote objects reported by providers with the recorded state and prepares state updates for detected drift without changing the infrastructure. HashiCorp documents refresh-only mode as the way to synchronize Terraform state with externally changed infrastructure.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!