The deletion trap
Learn
The deletion trap
Delete the state file and the real resources don't go anywhere. Only Terraform's memory of them does:
# demo_network.main will be created
+ resource "demo_network" "main" {
…
# demo_server.web will be created
+ resource "demo_server" "web" {
…
Plan: 2 to add, 0 to change, 0 to destroy.
From Terraform's point of view, nothing exists, so it plans to create everything. If you applied this, you'd get a second network and a second server next to the originals: duplicates you pay for, and originals Terraform no longer manages at all. Where names must be unique, the apply fails halfway instead.
State files get lost the boring ways: a laptop dies, someone cleans up a directory,
terraform.tfstate was in .gitignore and the only copy was local. That's one reason
real teams keep state remotely, versioned, and never on one machine.
Your task
Now the dangerous one. Click Delete the state file, then run plan. Real Infrastructure still exists — but Terraform's memory is gone, so it wants to create both resources again. That's the duplication trap. Then answer the questions below.
Your answers are checked when you run this step.