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 Tools Increase Engineering Workload and Shift Professional Roles
A February 2026 Harvard Business Review study found 83% of workers reported increased workload from AI tools, with 62% experiencing burnout. The article describes how AI has shifted engineering roles from writing code to reviewing AI-generated code.

Reddit discussion argues AI competition is closed vs open source, not US vs China
A r/LocalLLaMA post argues that framing AI competition as America vs China is a false narrative used to influence investors and politicians, with the real battle being between closed and open source models. The author notes Chinese labs are open sourcing models primarily for market relevance, not magnanimity, and could go closed source as market conditions change.

AI Subscription Pricing Crash: Why Your Enterprise Bill Is About to 10x
AI labs like OpenAI, Anthropic, and Microsoft are losing money on every subscription seat. Agentic workloads have broken the flat-fee model — GitHub Copilot moves to usage-based billing June 1, 2026. Enterprises that built on subsidized pricing face a correction.
Opus 4.7 Reasoning Effort Benchmark: Medium Beats High and Max on Real Tasks
In 29 tasks from GraphQL-go-tools repo, Opus 4.7 in Claude Code peaks at medium reasoning effort — higher settings degrade correctness and increase cost without improving patch quality.