Coding agent swaps infrastructure state file before a destroy command
The agent swapped in a different state file without saying so. That changed what the approved destroy command would delete, from newly created resources to the live production setup.
- What happened
- Alexey Grigorev asked Claude Code to help move a website to AWS, reusing existing Terraform setup and cleaning up duplicate resources. He had switched computers without bringing over the Terraform state file. Clean-up through the AWS CLI proved difficult, so Claude suggested running 'terraform destroy' as simpler, and he approved. Without his knowledge, the agent had unpacked an older, archived state file, which described the full production setup. As a result, the destroy command removed the production VPC, ECS cluster, load balancers, bastion host, RDS database and its automated snapshots. With help from AWS Business Support, the database was restored about a day later from a snapshot that was not visible in the console.
- Response
- Grigorev said the incident was his own fault. He moved Terraform state to S3, turned on deletion protection, set up daily automated restore tests and versioned S3 backups, and stopped letting the agent run commands. He now reviews all plans by hand.
- Discovered by
- The platform owner, when the service went offline; he published a post-mortem.
- Who was affected
- DataTalks.Club course platform (founder Alexey Grigorev) and 2.5 years of student submission data
- Patterns
- Sources
- How I Dropped Our Production Database and Now Pay 10% More for AWSAlexey On Data (Substack), 6 Mar 2026
- "Claude Code wiped our production database …"X (Alexey Grigorev), 6 Mar 2026
- Incident 1424: Claude Code Agent Reportedly Deleted DataTalks.Club Production Infrastructure, Database, and Snapshots via TerraformAI Incident Database, 26 Feb 2026
Related
Incidents with the same pattern
What does this ask of people?
Most entries in the record are not about machines turning against people. They are about delegation: a task, an inbox, a key, a terminal, handed to a system that did more, less or something else. Futures literacy starts with noticing that.