---
id: blog/en/datatalks-terraform-state-destruction
type: blog
language: en
title: "DataTalks.Club: restored Terraform state changes destruction scope"
description: Alexey Grigorev links local state, shared infrastructure and destruction. Review the plan and the separate recovery boundary.
summary: Alexey Grigorev links local state, shared infrastructure and destruction. Review the plan and the separate recovery boundary.
url: https://rootzero.eu/en/research/datatalks-terraform-state-destruction/
markdown_url: https://rootzero.eu/en/research/datatalks-terraform-state-destruction/index.md
author: rootzero
published: 2026-11-17T00:00:00.000Z
updated: null
tags:
  - IA
  - Sécurité
  - Agents
topics:
  - id: ai-methods
    name: AI and methodology
    url: https://rootzero.eu/en/research/topics/ai-methods/
translations:
  en: https://rootzero.eu/en/research/datatalks-terraform-state-destruction/
  fr: https://rootzero.eu/research/datatalks-terraform-etat-destruction/
reading_minutes: 2
content_origin: source-analysis
research_reference: null
research_status: null
vulnerabilities: []
references:
  - label: first-person account
    url: https://aishippingblog.com/p/how-i-dropped-our-production-database
  - label: state
    url: https://developer.hashicorp.com/terraform/language/state
  - label: terraform plan -out
    url: https://developer.hashicorp.com/terraform/cli/commands/plan
  - label: prevent_destroy
    url: https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#prevent_destroy
sections:
  - title: State identifies existing objects
    level: 2
    url: https://rootzero.eu/en/research/datatalks-terraform-state-destruction/#state-identifies-existing-objects
  - title: Review the changed situation
    level: 2
    url: https://rootzero.eu/en/research/datatalks-terraform-state-destruction/#review-the-changed-situation
  - title: Recovery depended on another system
    level: 2
    url: https://rootzero.eu/en/research/datatalks-terraform-state-destruction/#recovery-depended-on-another-system
  - title: Review the actual targets
    level: 2
    url: https://rootzero.eu/en/research/datatalks-terraform-state-destruction/#review-the-actual-targets
---

# DataTalks.Club: restored Terraform state changes destruction scope

> Alexey Grigorev links local state, shared infrastructure and destruction. Review the plan and the separate recovery boundary.

Alexey Grigorev describes a Terraform state restoration bringing DataTalks.Club production infrastructure into a cleanup operation. His [first-person account](https://aishippingblog.com/p/how-i-dropped-our-production-database) covers infrastructure shared with another project, a new computer without local state and transfer of an old archive. The agent used that state and started a destruction the user allowed to continue, believing it targeted duplicates.

This account includes human decisions and agent-assisted execution. It does not support describing the destruction as autonomous action without human involvement. The technical question is how loaded state, actual target objects and authorization were bound together.

![Missing state → Duplicates created → Old state restored → Production selected. Scope follows the objects associated with the active state.](https://rootzero.eu/_astro/a26-en.BZQJBvSj_1dN2yb.webp)

_Scope follows the objects associated with the active state._

## State identifies existing objects

Terraform [state](https://developer.hashicorp.com/terraform/language/state) maps configuration addresses to remote objects. It is more than a command history. Restoring old state can reintroduce mappings to resources still serving production.

A fictional example illustrates the mismatch:

```text
Terraform address: module.service.aws_db_instance.primary

Expected cleanup state:
  remote identifier = lab-copy

State restored from an archive:
  remote identifier = production-primary
```

The logical address stays the same; the target object changes. A task comment calling it a copy cannot change the identifier stored in state.

Verify the backend, workspace, state version and remote identifiers. The current directory’s name establishes none of these properties.

## Review the changed situation

The account describes an initial attempt to create resources without the expected state, followed by interruption. Introducing an archive later changed the environment’s representation. A plan prepared before that change may no longer describe the next operation.

A proposed workflow binds the accepted plan to configuration revision, provider identity, backend, workspace and target-object list. Changes to those inputs require a new plan and scope review.

[`terraform plan -out`](https://developer.hashicorp.com/terraform/cli/commands/plan) can save a plan for later application. Protect the file because it may contain sensitive data. A stable filename does not establish that reviewers inspected its current contents; a digest can bind review to a specific artifact.

These are proposed operating controls. The incident’s public sources do not provide enough evidence to reconstruct every plan actually used.

## Recovery depended on another system

The author reports losing associated automatic backups and later recovering through AWS support. This highlights dependencies between service deletion and copy retention. It guarantees no equivalent recovery route for another account.

Recovery planning must therefore remain independent of a successful support request. Identify the retained copy, its owner, its keys and its restore path in advance to measure what the team actually controls.

Terraform [`prevent_destroy`](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#prevent_destroy) can add a denial in certain configurations. It does not cover every deletion, including cases where resource configuration is removed. Cloud permissions and backup retention remain separate controls.

## Review the actual targets

A destruction review should identify real objects, their environment and dependencies removed with them. A request to clean duplicates does not define that scope.

If old state arrives during a task, stop promoting the existing plan and inspect its mappings. Shared infrastructure requires reviewing the other project’s services too. Project names do not enforce provider-side isolation.

This analysis examines the account and Terraform documentation; we destroyed no infrastructure to verify it. Complete provider logs and the full authorization exchange remain unavailable in the cited public record.
