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 12 / 37

What Is tfstate?

The state file is Terraform's record of what it has created and which real resource corresponds to each block in your configuration.

It is how Terraform knows, on the next run, that aws_instance.web already exists as instance i-0123… and needs changing rather than creating.

Running terraform show displays the current state in readable form, so you can see what Terraform believes exists.

A common stumble is committing the state file to Git. It contains resource details and often secrets, and concurrent edits corrupt it — it belongs in a remote backend.

In real work, state lives in S3 or Terraform Cloud with locking enabled, so a team can work on the same infrastructure safely.

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

🧑‍💻 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)