Terraform Guide

Terraform graph alternative: from DOT hairball to a diagram your team reads

terraform graph is the first thing everyone tries and the first thing everyone abandons. It needs a working init, it emits Graphviz DOT, and it draws every dependency edge with equal weight, so a forty-resource stack renders as a hairball where aws_iam_role_policy_attachment gets the same billing as your VPC. This page covers what a usable alternative has to do differently, and how Datadef does it from the repository alone.

7 min readFor platform engineers who ran terraform graph once and closed the tab

See it as a diagram

Everything below, as a diagram you can edit. Describe yours and see it in seconds.

138/20003 credits left
Try:

No account needed · Editable canvas, not a picture

Why terraform graph fails as documentation

The command was built for debugging the dependency resolver, not for people. Three properties make it unusable as documentation. It shows the plan graph, so every provider, every data source, and every meta-resource appears as a node. It has no notion of importance, so a random_password sits next to the EKS cluster at the same size. And it outputs DOT, which means a second tool, a layout fight, and a static image nobody regenerates.

The deeper problem is that the plan graph is the wrong abstraction. Readers do not think in dependency edges; they think in modules, environments, and the handful of resources that matter. A diagram that shows 100 percent of edges communicates none of them.

What a real alternative has to do

Parse the source, not the plan. Reading .tf files directly means no init, no provider downloads, no backend access, and it works in CI or from a read-only connection. The structure people care about lives in the source anyway: module blocks, resource blocks, variable wiring.

Curate deterministically. The subject of a Terraform diagram is the platform: the workspace, the network, the databases, the compute. The wiring underneath it, role assignments, grants, random suffixes, policy attachments, belongs in a count, not in boxes. A useful tool decides this before drawing, the same way every time.

Keep module structure. Terraform authors already organized the repo into modules with meaningful names. Drawing modules as container zones and resources inside them reuses the mental model the team already has.

How Datadef draws a Terraform repository

Connect the repo from GitHub, GitLab, or Azure DevOps with a read-only token (public repositories need none) and pick a branch or tag. Datadef parses every .tf and .tfvars file: stacks, modules, resources, data sources, count and for_each, cross-module references resolved through outputs. No state file is read and nothing is executed.

The result is curated before drawing: major resources stay individual nodes with their provider icons, repeated minor types roll up into one node carrying the count and the member names, and identity wiring becomes a note. A 123-resource platform reads at around 36 nodes in module zones. The diagram regenerates on a daily sync and on demand, so it stays the repository rather than a screenshot of it.

The sync also writes an architecture doc with a generated module reference table, and the diagram embeds in your README or wiki as a live image that updates with the canvas.

No init, no state

Everything is parsed from source. That is what makes it safe to point at a production repo: read-only access, nothing executed, nothing fetched from your cloud. See how repository sync works.

FAQ

Why is terraform graph output so hard to read?

It renders the dependency resolver's plan graph: every resource, data source, provider, and meta-node, with every edge drawn at equal weight. That is the right data for debugging cycles and the wrong data for communicating architecture, because readers think in modules and important resources, not in the full edge set.

Does Datadef need terraform init or a state file?

No. It parses the .tf and .tfvars files of the connected repository directly. No init, no plan, no state access, no cloud credentials. That also means it works on repositories you can only read.

How does it decide what to show and what to hide?

Deterministically, before the drawing step. Major resources like clusters, databases, networks, and storage stay individual nodes. Repeated minor types collapse into one node with the count and member names. Role assignments, grants, and random resources are counted in a note instead of drawn. The full inventory stays available in the generated module reference table.

What happens when the repository changes?

A daily sync re-reads the branch or tag and regenerates the diagram and the doc. Unchanged commits are skipped. You can also trigger a sync from the UI or from an MCP client like Claude Code or Cursor.

Does it work with OpenTofu repositories?

Yes. OpenTofu uses the same HCL language and file layout, and the parser reads the source files, so an OpenTofu repository analyzes the same way a Terraform one does.