terraform.tfstate
What is terraform.tfstate?
terraform.tfstate: The default local state file. A JSON document; never edit it by hand — use the state subcommands. terraform.tfstate is the default local state file, a JSON document where Terraform records every resource it manages and its current attributes. It is created in your working folder when you use local state. That is fine for experiments, but risky for real infrastructure: it lives on one machine, has no locking and often contains secrets in plain text.
Frequently asked questions about terraform.tfstate
What should you keep in mind with terraform.tfstate?
Never edit it by hand. Use terraform state subcommands, or moved and import blocks, for any changes. Never commit it to Git; add *.tfstate and *.tfstate.backup to .gitignore. For anything shared or long-lived, move to a remote backend with locking and versioning. terraform init -migrate-state copies existing local state to the new backend.
What does an example of terraform.tfstate look like?
cat terraform.tfstate | jq .resources At a glance
| Category | Terraform |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |