Let's think about this for a second
The state file (`terraform.tfstate`) records every current attribute (ID, IP address, tags) of each resource in JSON format — every time Terraform runs, it diffs the configuration (what you want) against the state (what already exists) to decide what to do. If the state file is lost, Terraform no longer 'knows' those resources exist at all — it might try to create them again (leading to duplicate resources). The `terraform state list` (view the resource list) and `terraform state show <resource>` (view attribute details) commands are useful for inspecting state.
Let's connect this to a real scenario
If two team members (on two separate laptops) each keep the state file only on local disk, one person's apply can leave the other person's state stale (not updated) — leading to conflicts or duplicate resources (which is why production setups use Remote State, covered in a later chapter).
Let's look at an example
# List all resources Terraform is tracking
terraform state list
# Show full detail of one resource
terraform state show aws_instance.web
# See the raw state file (JSON) — read-only inspection
cat terraform.tfstate$ terraform state list
aws_instance.web
local_file.greeting5-minute try-it
If you already applied the local_file resource from the first-resource lesson, run `terraform state list` and `terraform state show local_file.greeting` — read through the attributes in the state yourself.
A quick word of caution
If you delete the state file without a backup (or it gets corrupted), it can become very difficult to manage your production infrastructure again — always use Remote State plus versioning in production.