DELAPARRA
Index
Color
NL
Category: Terraform

terraform.tfstate

Explained by Updated

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.

Definition source Coders Lingo, CC BY 4.0

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

CategoryTerraform
Explained by
Updated

More Terraform terms

All terms starting with T

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.