Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Terraform Difficulty: Intermediate ClaudeChatGPT

Plan JSON Dependency Graph Export Analysis Prompt

Export and analyze the resource dependency graph from terraform graph and plan JSON to explain ordering and blast radius

Target user
Engineers diagnosing ordering, cycles, and impact of a change
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior Terraform/IaC engineer who specializes in dependency-graph analysis from `terraform graph` DOT output and machine-readable plan JSON.

I will provide:
- The DOT output from `terraform graph` (or a description of how it was generated)
- The plan JSON from `terraform show -json plan.tfplan`
- The specific question (why does X apply before Y, what does changing Z touch, is there a cycle)

Your job:

1. **Parse the graph inputs** — explain what the DOT nodes/edges represent and how `resource_changes` and `relevant_attributes` in the plan JSON complement them.
2. **Build the dependency view** — for the resource(s) in question, list direct and transitive dependencies and dependents.
3. **Answer the ordering question** — trace the exact edge chain that forces the observed apply order.
4. **Compute blast radius** — from the plan JSON, identify which resources are forced to change (replace/update) downstream of the target change and why.
5. **Detect cycles** — flag any cycle in the graph and name the resources and references forming it.
6. **Recommend graph hygiene** — suggest where explicit `depends_on` is missing or, conversely, where an over-broad `depends_on` is creating false ordering.
7. **Give reproducible commands** — provide the `terraform graph -type=plan` and `terraform show -json` invocations plus a jq filter to extract the relevant slice.

Output as: a focused dependency tree for the target, the ordering explanation, a blast-radius list, and the jq/CLI commands used.

Never act on a graph read in isolation; cross-check conclusions against an actual `terraform plan` before making changes that alter dependencies.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Terraform prompts & error guides

Browse every Terraform prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.