Claude Code Deletes Production Database After Terraform State File Error

A developer detailed how using Claude Code with Terraform resulted in the complete destruction of production infrastructure, including a database and its recovery snapshots, erasing 2.5 years of records.
What Happened
Alexey Grigorev was moving his website, AI Shipping Labs, to AWS to share infrastructure with DataTalks.Club. Claude Code advised against this setup, but Grigorev proceeded anyway to avoid maintaining separate infrastructures.
The Technical Error
Grigorev used Terraform, an infrastructure management tool that can create or destroy entire setups including networks, load balancers, databases, and servers. He had Claude run a Terraform plan to set up the new website but forgot to upload a vital state file that contains a full description of the existing setup.
Without the state file, Claude created duplicate resources. After identifying the duplicates, Grigorev uploaded the state file, expecting Claude to clean up the duplicates first. However, with the state file now available, Claude logically followed it and issued a Terraform "destroy" operation to prepare for a correct setup, which wiped the entire production infrastructure including the database and snapshots.
Key Takeaways
- Terraform state files are critical for infrastructure management
- AI coding agents follow instructions literally without understanding context
- Production environments require careful validation before destructive operations
- Missing state files can lead to catastrophic data loss
📖 Read the full source: HN LLM Tools
👀 See Also

AI Agents That Don't Slash Maintenance Costs Will Sink Your Team
James Shore argues that doubling AI coding speed without halving maintenance costs leads to net productivity loss within months. Model shows 2x code output with 2x maintenance cost per line yields productivity worse than starting point after ~5 months.

Goldman Sachs Analysis Shows Minimal AI Impact on 2025 US GDP Growth
Goldman Sachs economists report AI investment contributed 'basically zero' to US GDP growth in 2025, citing imported hardware and unmeasured productivity impacts as key factors.

Claude Code v2.1.170: Claude Fable 5 Model Access and VS Code Session Fix
Claude Code v2.1.170 adds Claude Fable 5, a Mythos-class model with unprecedented capabilities, and fixes session transcript saving in VS Code integrated terminal.

Anthropic Blocks Claude Subscriptions via Third-Party Tools
Anthropic has implemented server-side blocks on Claude Pro/Max subscriptions used through third-party OAuth integrations, citing subsidized access being taken advantage of at scale. The policy change includes 'Extra Usage' billing that makes these integrations economically unviable.