All Tools View Categories About Contact Privacy

Terraform Graph Command Wrapper

Build terraform graph commands and render a Mermaid dependency graph from .tf.

Runs entirely in your browser - nothing is uploaded and no command is executed.
Your command will appear here.
Paste .tf and click Render Mermaid.
0
resources
0
edges

About Terraform Graph Command Wrapper

The dependency graph is one of the most useful mental models in Terraform. It shows exactly how resources, modules, variables and data sources depend on one another, and that dependency structure is what determines the order Terraform creates, updates and destroys them. The Terraform Graph Command Wrapper helps you build a correct terraform graph command without memorising every flag, and it goes further: paste any .tf configuration and it renders an instant Mermaid dependency diagram entirely in your browser.

Choose the graph type that matches your goal, toggle cycle highlighting to expose circular references, and control how deep module expansion goes. Engineers use this tool during code review to explain why a change touches more than expected, during incident response to trace a blast radius, and while onboarding to understand an unfamiliar workspace. Because everything runs client side, your configuration never leaves the page and no command is actually executed.

Most teams reach for this tool the moment a plan surprises them. Instead of reading a long plan diff, you get a picture of the resources involved and the edges between them. The Mermaid output can be pasted into any Mermaid live editor or dropped into documentation, so the same diagram that helped you debug also helps the next engineer who reads your pull request.

Features

  • Command builder - assembles terraform graph with the correct -type and flags for your goal.
  • Eight graph types - plan, plan-refresh-only, plan-destroy, apply, validate, input-variable, provider and module.
  • Cycle highlighting - the -draw-cycles flag surfaces circular dependencies that would deadlock an apply.
  • Module depth - the -module-depth flag limits or expands how far nested modules are drawn.
  • Output redirection - save the DOT graph to a file for rendering with Graphviz.
  • Mermaid renderer - turns pasted .tf into a flowchart of resource nodes.
  • Reference edges - draws a link from each resource to every resource it references.
  • Structural validation - flags configuration that cannot be parsed before you waste a render.
  • Export options - copy, download and print the assembled command or the diagram.
  • Live resource stats - after a render, a count of resources and reference edges is shown.
  • Wrap toggle - long commands and diagrams can be wrapped for easier reading.
  • Responsive layout - collapses to a single column on phones and small screens.

How to Use

  1. Pick the graph type from the dropdown that matches what you want to inspect.
  2. Enable cycle highlighting if you suspect a circular dependency.
  3. Set a module depth to control how much nesting appears.
  4. Name an output file if you want to redirect the DOT graph.
  5. Paste your .tf into the text area for a visual diagram.
  6. Click Build command to assemble the terraform graph invocation.
  7. Click Render Mermaid to convert the configuration into a flowchart.
  8. Read the findings - red errors mean the input could not be parsed.
  9. Copy or download the command for your terminal or the Mermaid for your docs.
  10. Toggle wrap if the command or diagram is too wide for your screen.
  11. Share the diagram by copying the Mermaid block into your wiki or review.

Examples

Suppose you want to see why a planned apply touches more than you expected. Build terraform graph -type=plan -draw-cycles -module-depth=1 and run it through Graphviz, or paste your main.tf and click Render Mermaid. With a security group and an instance that references it, the diagram shows two nodes and an edge from the instance to the group. That single edge explains the ordering Terraform will use. Choosing -type=plan-destroy gives the reverse ordering used during teardown, which is exactly what you want to check before a risky destroy.

You can also combine flags: -type=module -module-depth=2 expands two levels of module calls so you can see which remote modules contribute resources to the workspace. The wrapper never executes anything, so experimenting with flag combinations is safe and instant, and the resulting command can be copied straight into a terminal or a CI script.

Benefits

  • Clear dependencies - see the real ordering at a glance.
  • Faster reviews - explain blast radius with a picture.
  • Private - parsed locally, nothing uploaded.
  • Portable - copy the command or Mermaid anywhere.
  • Educational - learn how Terraform resolves references.
  • Live stats - quantify the size of the dependency picture at a glance.

Frequently Asked Questions

What does terraform graph do?
It outputs the dependency graph of your configuration (or plan/state) in DOT format which you can render with Graphviz. The wrapper assembles the command with the right -type and flags.
Can I visualize from pasted .tf?
Yes. Paste main.tf content and the tool parses it with tfParse and produces a Mermaid flowchart of resource nodes and their references.
What -type values are supported?
plan, plan-refresh-only, plan-destroy, apply, validate, input-variable, provider, module. The default is plan.
What is -draw-cycles?
It highlights dependency cycles in the graph output, which is useful for debugging circular references.
Is anything executed?
No. Commands are assembled as text and the Mermaid graph is built locally. Nothing is run or uploaded.
How do I render the Mermaid output?
Copy the Mermaid code into any Mermaid live editor or your docs pipeline.