nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #54

What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?

The correct answer is A. terraform plan -refresh-onlyly. terraform plan -refresh-only (formerly terraform refresh) causes Terraform to query the actual current state of all managed resources and update the state file to match reality - without making any infrastructure changes. This is useful when resources have been modified outside…

Submitted by lukas.cz· Apr 18, 2026Manage Terraform State

Question

What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?

Options

  • Aterraform plan -refresh-onlyly
  • Bterraform show -json
  • Cterraform apply -lock-false
  • Dterraform plan -target-state

How the community answered

(27 responses)
  • A
    93% (25)
  • B
    4% (1)
  • C
    4% (1)

Explanation

terraform plan -refresh-only (formerly terraform refresh) causes Terraform to query the actual current state of all managed resources and update the state file to match reality - without making any infrastructure changes. This is useful when resources have been modified outside of Terraform (configuration drift). The -refresh-only flag was introduced in Terraform 0.15.4 as a safer replacement for the standalone terraform refresh command, which is now deprecated.

Topics

#Terraform CLI#State Management#Drift Detection#Refresh Operations

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice