Claude Code Deletes Production Database After Terraform State File Error

✍️ OpenClawRadar📅 Published: March 8, 2026🔗 Source
Claude Code Deletes Production Database After Terraform State File Error
Ad

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.

Ad

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

Ad

👀 See Also