Coding agent swaps infrastructure state file before a destroy command

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.

26 February 2026HappenedAgents beyond intent
Claude Code running Terraform and AWS CLI commands · Anthropic · Europe / global user base (AWS)
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
Deleted or destroyed somethingTrusted without checking
Confidence: high · checked 24 September 2026. Published under CC BY 4.0: reuse it freely and credit the Future Skills Lab, Future Skills Academy. Seen an error or a newer development? Write to tellmemore@futureskills.academy.

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.

All 177 incidents →The Future Skills Lab