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
-
Terraform Conftest Plan-JSON Gating Prompt
Wire conftest (OPA/Rego) into CI to evaluate the `terraform show -json` plan output, so policy violations fail the pipeline on the actual planned changes rather than on static config — with clear pass/warn/deny tiers and readable failure messages.
-
Terraform Dependency Graph Debugging Prompt
Diagnose cycle errors, unexpected resource ordering, and 'value not known until apply' problems by reading Terraform's dependency graph and reshaping references instead of guessing with `depends_on`.
-
Terraform Blue Green Deployment Pattern Prompt
Implement blue/green infrastructure deployments in Terraform with parallel resource sets, create_before_destroy, and weighted DNS or target-group cutover with rollback.
-
Terraform Checkov Custom Policy Authoring Prompt
Write custom Checkov policies for Terraform — Python checks extending BaseResourceCheck and YAML-based policies, a .checkov.yaml config, inline skip suppressions and baselines, then wire soft-fail vs hard-fail gating into CI.
More Terraform prompts & error guides
Browse every Terraform prompt and troubleshooting guide in one place.
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.