nerdexam
HashiCorp

TA-002-P · Question #302

True or False. The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. If drift is detected between the real-world i

The correct answer is A. False. The terraform refresh command updates the state file to reflect real-world infrastructure changes but does not modify the infrastructure itself.

Use the Terraform CLI (terraform plan, apply, destroy, fmt, init, validate, workspace, import, taint, providers, output)

Question

True or False. The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. If drift is detected between the real-world infrastructure and the last known-state, it will modify the infrastructure to correct the drift.

Options

  • AFalse
  • BTrue

How the community answered

(28 responses)
  • A
    89% (25)
  • B
    11% (3)

Why each option

The `terraform refresh` command updates the state file to reflect real-world infrastructure changes but does not modify the infrastructure itself.

AFalseCorrect

The `terraform refresh` command is designed to detect and report configuration drift by updating the Terraform state file to match the current actual state of resources. It does not apply any changes or modify infrastructure resources to correct detected drift; its role is solely to update the state file.

BTrue

`terraform refresh` only updates the state file to reflect infrastructure changes, it does not modify the infrastructure to correct drift.

Concept tested: Terraform refresh command behavior

Source: https://developer.hashicorp.com/terraform/cli/commands/refresh

Topics

#terraform refresh#Terraform CLI#state management#infrastructure drift

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice