Ad space (banner)
AD

Got the fundamentals? A structured Terraform course is a fast way to level up.

Find Terraform courses on Udemy

Affiliate link. Costs you nothing extra.

Lesson 29 / 37

What Is terraform refresh?

terraform refresh updates state to reflect what actually exists in the cloud right now.

It queries every managed resource and records what it finds, without changing any infrastructure.

Running it reports each resource being refreshed, and afterwards state matches reality — including any changes made outside Terraform.

A common stumble is expecting it to fix a drift. It records the drift; the next plan then proposes bringing things back in line with your configuration.

In real work, modern Terraform refreshes automatically during plan, so the standalone command is used mainly when diagnosing.

Terraform
Try it (type this into the pseudo terminal)
terraform refresh

🧑‍💻 You can type this command into the Terraform pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)