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

Sakana AI Launches RSI Lab: Recursive Self-Improvement with Foundation Models
Sakana AI formally launches its Recursive Self-Improvement Lab, building on published research like LLM-Squared, Darwin Gödel Machine, and The AI Scientist to create autonomous, self-improving AI systems.

Cannes Film Cost $500k to Make, $400k Was AI Compute Costs
A film screened at Cannes cost $500k to produce; $400k of that was spent on AI compute. A striking data point for AI agent developers building generative video pipelines.

Research on Professional Social Networks for AI Agents
Analysis of intent, behavior, and platform trends for professional AI agent social networks, focusing on Moltbook, Agent.ai, and Clawsphere, with examination of Meta's acquisition impact.

GM Lays Off 600 IT Workers, Hires AI-Focused Engineers for Agent and Model Development
General Motors cut 600 IT employees (~10% of the department) to hire workers with AI-native skills: agent development, data engineering, cloud engineering, prompt engineering.