Generate from source

Generate an architecture diagram from Terraform.

Terraform already describes your infrastructure precisely. The diagram is a rendering of something you have written down, not a guess.

Download for macOS
v0.1.33 · .dmg · Apple Silicon & Intel
Signed & notarized by Apple · opens without a Gatekeeper warning
sha256 698955a0187bc039f4c74f5d05a9f10fbb27376a45788a0a241d1326b73873c7
Download for Windows instead
$curl -fsSL https://lucidtrain.com/install.sh | sh

What it reads

Every .tf file in the directory tree, plus variables and locals so that names resolve to something meaningful rather than to an interpolation. If a state file or a saved plan is available it reads that too, which is a meaningful upgrade: configuration tells you what should exist, state tells you what does, and the two differ more often than anyone likes. Modules are followed into their source directories so a diagram of a root module is not just a diagram of module blocks.

How resources become components

Resource types map onto tiers: compute and container services into the application tier, managed databases and buckets into data, load balancers and gateways into edge, and anything from a provider you do not run into external. Edges come from references between resources, which is the part that makes Terraform such a good source. When one resource interpolates another's attribute, that is a real dependency the language has recorded for you, so the edges are read rather than inferred.

Why the layout can be trusted

The agent reads the files listed above and emits a semantic graph: components, the tier each belongs to, and the edges between them, with no coordinates anywhere. The ELK layout engine then computes positions and orthogonal edge routing. This is why the output cannot come back with boxes overlapping or arrows crossing through cards, which is the usual failure when a language model is asked to place things on a canvas itself.

Where it beats reading the console

A cloud console shows you resources grouped by service type, which is the least useful grouping for understanding a system. Terraform is already organised by intent, so the diagram comes out grouped the way you think about it. It also covers everything in the configuration at once, rather than requiring you to visit six product pages to assemble a mental picture.

Your configuration stays on your machine

It runs on your machine. With a local Ollama model nothing leaves the laptop at all, and with your own API key the file contents go to the provider you chose and never through us. For a source that is your actual codebase, that distinction is usually the deciding one.

Terraform to diagram

In the configurationIn the diagram
*.tf, *.tfvarsThe resource set that is drawn
terraform.tfstate or a saved planWhat actually exists, rather than what is declared
module blocks, followed to sourceGrouped components rather than opaque boxes
References between resourcesEdges, read from the configuration rather than inferred
depends_onExplicit ordering edges
Compute and container resourcesApplication tier
Managed databases, caches, bucketsData tier
Load balancers, gateways, CDNEdge tier
Third-party providersExternal tier

The prompt

shell
$ Read the Terraform in this directory and diagram the infrastructure it describes. Group by tier and show the dependencies between resources.
FAQ

Questions

Does it run terraform plan?

No. It reads files, and it will use a plan or state file if you point it at one. Nothing here executes Terraform or touches your cloud account, which also means it needs no credentials.

Does it need AWS or GCP credentials?

No, and that is deliberate. Everything comes from the configuration on disk. A tool that wants production credentials to draw a picture is asking for a great deal in exchange for very little.

Will it handle a large multi-module repository?

Yes, though the useful output is usually per root module rather than everything at once. A diagram of forty modules is accurate and unreadable, which is a failure of a different kind.

What about Pulumi or CloudFormation?

Both work, since it is reading and reasoning about files rather than using a Terraform-specific parser. Terraform gets its own page because the reference structure of HCL makes the edges unusually reliable.

Related