# Terraform Plan Check

> Show what a Terraform or OpenTofu plan destroys or replaces before you apply: one row per change with action_reason, replace_paths and a holds-data label for AWS, GCP and Azure types; drift listed apart; exit 1 for CI when data would be lost; NOTHING REVIEWED, not PASS, on a plan it could not read.

Terraform Plan Check is a paid AI agent skill on Agensi by Hale Sinclair, in DevOps & Cloud. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $7 (one-time purchase)
- Creator: [Hale Sinclair](https://www.agensi.io/creators/hale-sinclair)
- Category: [DevOps & Cloud](https://www.agensi.io/skills/devops-cloud)
- Version: 1.0
- Last updated: 2026-12-01
- Security: scan passed (2026-12-01); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/terraform-plan-check
- Tags: devops, code-review, security, terraform, opentofu, terraform-plan, iac, ci-gate

## About this skill

### The problem
`terraform plan` ends with a count such as `1 to add, 0 to change, 1 to destroy`. Behind it can be a database deleted and created again, empty, because one attribute (`storage_encrypted`, a name, an engine) cannot change in place; the line that says so is one of hundreds in the plan's text. A block removed from the configuration, or an item gone from a `count` list, deletes the object it managed. And a reviewer, human or agent, that skips the part of a plan it cannot read often does so without a word.

### What it does
Your agent runs one standard-library Python script over the plan's JSON (`terraform show -json tfplan`, from Terraform 0.12 onward or OpenTofu, or the redacted plan JSON that HCP Terraform's API serves for a run) and explains the result. One row per resource change (each `count` and `for_each` instance, each module's resources and each deposed object is its own change): the address, the plan's own action, its `action_reason` (cannot update, tainted, `-replace`, `replace_triggered_by`, the block removed, a `count` index or `for_each` key gone), the `replace_paths` that force a replacement, whether the type holds data, and how many values are sensitive or unknown until apply. Each row has a class:
- **FAIL**: a delete or replace of a type that holds data: databases, caches, buckets, volumes and disks, file systems, keys, DNS zones, secrets, queues, registries, log groups, and what deletes its contents with it (a resource group, a project, a CloudFormation stack). A type the built-in table does not name counts as holding data. With `--strict`, every delete or replace is FAIL.
- **REVIEW**: a delete or replace of a type that holds no data, an update in place of one that does, a forget, a move, and the value rules on the after-values: ingress open to `0.0.0.0/0` or `::/0` (AWS security groups and their rules, `google_compute_firewall`, Azure NSGs and their rules), `"*"` and service-wide (`s3:*`) IAM actions, Azure role actions `*`, the Google basic roles roles/owner and roles/editor, encryption, deletion protection, purge protection or HTTPS-only turned off, `force_destroy` and `skip_final_snapshot`, each on the types its row of the rule table names.
- **INFO**: a create, an update in place of a type that holds no data, a data source read, an import.

Drift (`resource_drift`: what changed outside Terraform since the last apply) is listed apart, not in the verdict. Each value a rule reads, and each key that says whether a rule applies (an SG rule's `type`, an Azure rule's `direction` and `access`, a Google firewall's `allow`, a policy statement's `Effect`), that is left out, null with no default cited in the rule table, unknown until apply, sensitive (in clear or redacted), of another type, or a policy that is not JSON, and each part of the plan it does not review (deferred changes, action invocations, a key it does not know), is listed with its JSON pointer. The verdict is PASS (exit 0) only when every change was read and nothing is listed as not read; otherwise FAIL n, INCOMPLETE n of m (anything not read, or a plan that says it errored or is not complete) or NOTHING REVIEWED (an empty file, a state file, a binary plan file, text, a plan with no change to read), each exit 1; a usage error exits 2. It reads the one file you name, opens no socket, calls no provider and writes only the `--out` file you give.

### How often it says PASS
How often it says PASS, measured: of the 96 real files of this check, 45 (47%) PASS, 6 FAIL, 22 are INCOMPLETE and 23 NOTHING REVIEWED (state files and plans with no change among them); of the 42 first applies (plans that only create), 26 PASS and 16 are INCOMPLETE, and of the 24 first applies in the AWS test plans of checkov and infracost, 9 PASS. On the current hashicorp/aws provider (6.x) a first apply is INCOMPLETE whenever it creates an aws_s3_bucket, aws_iam_role, aws_sqs_queue, aws_sns_topic, aws_kms_key, aws_secretsmanager_secret, aws_vpc_endpoint, aws_api_gateway_rest_api, aws_s3_access_point or aws_opensearch_domain whose policy is not written in its own block (the provider decides `policy`, `inline_policy` or `access_policies` at apply even when none is wanted), and whenever it creates an aws_instance (its `ebs_block_device` comes from the AMI at apply, even with `root_block_device` set). Setting a value does not clear these: read the separate policy resource's row (aws_s3_bucket_policy, aws_sqs_queue_policy and the others are read) and the AMI's block device mappings, and count those values as read by hand. Of 4 first applies planned with Terraform 1.17.2 and the current AWS provider (a bucket; twelve ordinary resources; an EC2 instance with its security group; the terraform-aws-modules VPC module), none PASS, and of 106 first applies in terraform-compliance's test plans (mostly Terraform 0.12), 43 (41%) PASS and 25 of its 87 AWS ones. A first plan is INCOMPLETE when a value a rule reads is decided at apply (an instance's `ebs_block_device`, an unset policy, a policy that names a resource not made yet) or a setting a rule needs (encryption, deletion protection) is left out, or is null and references/rules.md cites no default for it: that setting you can set in the configuration; what is decided at apply you read by hand. A VM replace is REVIEW, not FAIL: its row names the disks that go with it.

### What you get that prompt-only skills don't
- **The rules are a table, not memory.** The same plan gives the same rows every time; the 33 rules are data the check tests one by one, each with an example that fires it and a near miss that fires another.
- **What was not read is counted and named**, with its JSON pointer, and a run that read nothing says NOTHING REVIEWED: a missing row is not presented as proof that nothing is lost.
- **Read on real plans, not only on a demo:** 96 real plan files of five origins, compared row by row with two other engines (below).
- **A CI exit code** that stops an apply losing data, and a JSON form of every row.

### Next to the Terraform plan skills already listed
Their own listing words, and what this one does about each (no package of theirs was downloaded: what their files do beyond their pages was not seen):
- *terraform-plan-review* ($5) already lists what is destroyed and what is replaced "(and which change forces it)", with a holds-data label from "a built-in list of types" for AWS, Google Cloud and Azure, an exit 1 for CI and JSON, and flags more kinds of setting than this one (ports one by one, public ACLs, public databases). Its page says other types are "listed but not judged"; here a type the table does not name counts as holding data, so its delete is FAIL. Each row here also carries the plan's own action reason, and drift is listed apart.
- *terraform-replacement-destruction-review-card* ($7) reads "format_version 1.x" plans up to a "maximum 20 MiB and 5,000 resource changes". Here format 0.1 plans of Terraform 0.12 are read as well, and a plan of 26,000 changes (69 MB) took 1.95 s and 386 MB of memory here.
- *terraform-plan-blast-radius-safe-state-surgery* ($9) says "Works with Terraform 1.1+ plan JSON and OpenTofu" and writes moved blocks, which this one does not. Here plans written by Terraform 0.12.31, 1.0.11, 1.14.0 and 1.17.2 and OpenTofu 1.6.3 and 1.13.10 were read, and a move already in the plan is its own row.
- *terraform-plan-blast-radius-review* ($12) says "A text-only plan is less precise than JSON." Here a text plan is not read at all: it says NOTHING REVIEWED and exits 1, so a CI step fed the wrong file stops.
- *aws-terraform-plan-auditor* ($9) reviews "cost-sensitive changes" on AWS. This one says nothing about cost, and reads Google and Azure types as well.
- *terraform-reviewer-security-cost-drift-before-you-apply* (free) adds "cost estimates" and reviews modules too. This one reads the plan only and gives no cost.
- *terraform-safety-check* ($5) is a "Static check of HCL text" before any plan. This one reads the plan, where `count`, `for_each` and module inputs are already evaluated, and needs one.

### Why pay $7 when terraform show or checkov is free
- `terraform show` and `terraform plan` are the authority, and free: every change is in their text, with "forces replacement" beside the attribute. This adds one row per change that a CI step and an agent read alike, the holds-data label, the plan's action reason on each row, drift apart, and an exit code that stops an apply that loses data. If you read every plan's text in full yourself, you may not need it.
- checkov is free and has far more policies (ports one by one, public ACLs, logging, tags), and it fails a provider default left unset; here a setting left unset makes the verdict INCOMPLETE, not FAIL, unless the rule table cites the provider's documented default for it (a `force_destroy` or `skip_final_snapshot` null is false: no row). For a compliance scan, use it. Its checks are about the configuration the plan arrives at, not about what the plan destroys or replaces.
- tf-summarize is free too and lists what each plan creates, updates, replaces and deletes; it needs installing, and on these plans it had no entry for data source reads, forgets or drift (below).
- What you pay for here, each proved by the check: nothing to install (one file, Python's standard library, run alone in an empty folder); the holds-data table read type by type; the lists of what was not read, with the place; a verdict that is PASS only when every change and every value a rule reads was read; and every row explained by your agent with what to change.

### How it works
- The agent gets the plan as JSON (`terraform plan -out=tfplan`, then `terraform show -json tfplan > plan.json`) and runs the script on it.
- It reads the verdict and its ending, each FAIL and REVIEW row, the drift and the lists of what was not read.
- For each FAIL row it says in plain words what would be lost, why Terraform wants it (the reason and the attribute), and what to change; it does not edit the configuration to make the verdict pass.

### What was checked, and how
Every number here is read from the check's own output (`check.out`) when this page is written.
- **504 regression cases** (paths and exit codes, BOM, UTF-16, CRLF, `\u` escapes, key order, files that are not a plan, format versions, the read-nothing gate, every action, holds-data, moved, import, forget, deposed, drift, the value rules, `--strict`, `--json`), each shown failing on at least one of 279 deliberately broken copies of the script, the rule table or SKILL.md.
- **The holds-data table, type by type:** every resource type of hashicorp/aws 6.74.0, google 8.12.0 and azurerm 5.15.0 (4,308 types; 246 hold data, 1,450 do not, the rest are unknown and count as holding data) gets the answer the check records.
- **Real plans of five origins**, kept or reduced with their sources (inputs/SOURCES.md): OpenTofu's own `show -json` test outputs, infracost's and checkov's test plans, one configuration planned by six Terraform and OpenTofu releases from 0.12 to 1.17, and offline Google and Azure plans. Some of the files are state outputs or plans with nothing to change, there to be refused:

| origin | files | with a change read | FAIL | REVIEW | INFO | NOT READ | drift | values not read | parts not read |
|---|---|---|---|---|---|---|---|---|---|
| OpenTofu test outputs | 34 | 25 | 3 | 10 | 58 | 0 | 3 | 0 | 7 |
| infracost test plans | 12 | 10 | 0 | 16 | 64 | 0 | 4 | 37 | 1 |
| checkov test plans | 24 | 23 | 1 | 28 | 127 | 1 | 0 | 40 | 2 |
| six engines, one configuration | 24 | 12 | 0 | 239 | 77 | 0 | 8 | 0 | 6 |
| Google and Azure, offline | 2 | 2 | 6 | 12 | 11 | 0 | 0 | 0 | 0 |

- **Ground truth against two other engines:** 790 rows (688 from 75 of the 96 real files, the rest from the demo and the examples of every rule) compared with tf-summarize 0.3.20 (what each change does) and checkov 3.4.11 (open ingress, star actions, protection off): 649 agree; each of the others is named: a change only one engine reports (104 only here, 32 only there), a class set differently (5), the other engine's gap or error (no entry for data source reads, forgets, no-ops or drift, a UTF-16 file it cannot parse, no check for a service-wide action), or a policy of this one, each stated under Known limitations.
- On those files, 50 faithful re-encodings (indented, compact, `\u` escapes, BOM, CRLF, UTF-16, keys reversed) changed no result; every unordered list reversed moved no fact; all 761 JSON pointers of the rows resolve in their plan and hold what the row shows; 14 one-fact changes each changed a row as named, and 15 planted changes each came out as their own row, once; of the 317 changes the engines' own text plans name, 0 have no row of that address and action; of 50 rows read by hand, 49 were right, 0 wrong and 1 debatable.
- The largest real plan (26 changes) takes 0.05 s; the same plan repeated to 26,000 changes (69 MB) takes 1.95 s and 386 MB of memory on the machine of this check.

### Known limitations
- The plan alone: what a provider does at apply time beyond what the plan says, and what outside the plan depends on these resources, is not seen. A missing row is not proof that nothing is lost.
- A value a rule reads, or a key that says whether a rule applies, that is left out, or null with no provider default cited in the rule table, makes the verdict INCOMPLETE, not PASS; checkov fails a provider default left unset. A null whose default the rule table cites, from the provider's docs, is read as that default: `force_destroy` and `skip_final_snapshot` null are false (no row), an RDS database's `deletion_protection` null is false (a REVIEW row that says so), a Google firewall's `direction` null is INGRESS. A null source range is no source.
- A value unknown until apply, sensitive (held in clear, or redacted as in HCP Terraform's redacted plan) or of another type, where a rule reads it is listed under values not read: that rule did not judge that resource, and the verdict is INCOMPLETE, exit 1.
- The value rules read creates, updates and replaces; a resource the plan leaves as it is, or deletes, has no value row (checkov checks those too). Values are compared trimmed and in any letter case.
- An output change is an INFO row and no value of it is read; a `checks` result is a row (a failed or errored one REVIEW).
- The Google basic-role rule names roles/owner and roles/editor only; roles/viewer and custom roles give no row (checkov fails roles/viewer too).
- Not checked: ports one by one (SSH or database ports), public bucket ACLs, publicly accessible databases, cost.
- A VM or `local_file` is a type that holds no data by the table, though a VM's root disk can: a VM's delete or replace is REVIEW, not FAIL, and its row names the disks that go with it.
- `aws_rds_cluster_instance` counts as holding no data (its data is in its `aws_rds_cluster`): its delete or replace is REVIEW.
- A setting with a documented default (`references/rules.md` cites each) that the plan shows as null is read as that default even where the plan marks it unknown until apply or sensitive, and the verdict can then be PASS: where `after_unknown` or `after_sensitive` marks such a setting, read it by hand.
- Where a rule expects a list (`cidr_blocks`, an Azure role definition's `actions`) and the plan holds a single string, the string is read as one value; an empty or blank string there is not reported as a value not read.
- Terraform 0.12 plans carry no sensitive marks and no drift: there the counts say nothing.
- A map key in `replace_paths` is shown like an attribute.
- A change whose before or after is not of the type the format says (an `after` of null on a create, a list where an object belongs) is NOT READ: no rule judges it, and the verdict is INCOMPLETE.
- JSON only: the text of `terraform plan`, a CI wrapper's printout or the binary plan file is NOTHING REVIEWED.
- Of the 50 rows read by hand, the one debatable is a VM create marked as holding no data (the limit above).

## Requires

- Python

No accounts, API keys, database connection or services. Python 3.9+ on the machine.

## Known limitations

It reads the plan alone: what a provider does at apply time, and what outside the plan depends on these resources, is not seen, and a missing row is not proof that nothing is lost. A value a rule reads, or a key that says whether a rule applies, that is left out, null with no provider default cited in the rule table, unknown until apply, sensitive (in clear or redacted) or of another type makes the verdict INCOMPLETE; value rules read creates, updates and replaces (not deletes or resources left as they are), no value of an output change is read, and the Google basic-role rule names roles/owner and roles/editor only. Not checked: single ports, public ACLs, public databases, cost. A VM is a type that holds no data by the table: its delete or replace is REVIEW, not FAIL. `aws_rds_cluster_instance` counts as holding no data (its data is in its `aws_rds_cluster`): its delete or replace is REVIEW. A setting with a documented default (`references/rules.md` cites each) that the plan shows as null is read as that default even where the plan marks it unknown until apply or sensitive, and the verdict can then be PASS: where `after_unknown` or `after_sensitive` marks such a setting, read it by hand. Where a rule expects a list (`cidr_blocks`, an Azure role definition's `actions`) and the plan holds a single string, the string is read as one value; an empty or blank string there is not reported as a value not read. Each count and for_each instance and each resource in a module is judged from its own resource change: the plan's configuration (module sources and versions, the count and for_each expressions) is not read, so a shifted count index shows only as the changes the plan lists for each item, not as one shift. JSON only: a text plan or a binary plan file is NOTHING REVIEWED. A change nested more than a hundred levels deep is NOT READ (the real plans tried here nest seven deep at most); a file nested past what Python's JSON reader takes is NOTHING REVIEWED.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Terraform Plan Check skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### Does it call my cloud, or need credentials?

No. It reads the one plan JSON file you name, opens no socket, runs no program and calls no provider; it writes only the --out file you give. Making the plan (terraform plan) is yours, with your usual credentials.

### What does PASS mean?

That every change and every value a rule reads was read, and none of the 33 rules found a FAIL row: no delete or replace of a type that holds data. It is not approval: read every REVIEW row. A run that read nothing says NOTHING REVIEWED, and one that left anything not read (a change, a value unknown until apply, a setting left to the provider) says INCOMPLETE n of m; both exit 1. Measured on the real files of this check: 45 of 96 PASS.

### I have the text of terraform plan, or the tfplan file. Does it work?

Not directly: it reads the JSON only, and says NOTHING REVIEWED for text or a binary plan file. Run terraform show -json tfplan > plan.json (or tofu show -json) first; Terraform 0.12 and later and OpenTofu write that format. From HCP Terraform, the redacted plan JSON its API serves for a run (json-output-redacted) is read too; the script fetches nothing itself.

### Can I use it as a CI gate?

Yes: exit 0 on PASS, 1 on FAIL, INCOMPLETE or NOTHING REVIEWED, 2 on a usage error, and --json gives every row with its pointer. --strict makes every delete and replace FAIL, whatever the type holds.

### How does it know which types hold data?

From a built-in table of AWS, Google and Azure types, checked against every resource type of those three providers. A type the table does not name, including every type of any other provider, counts as holding data, so its delete is FAIL; a VM counts as holding none, which is a stated limit.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
