Convert Terraform into an architecture diagram.
Terraform records dependencies explicitly through references, so the edges are read rather than inferred. It is one of the most reliable sources there is.
Why Terraform converts well
When one resource interpolates another's attribute, that is a dependency the language itself has recorded. Most sources require inferring relationships; here they are declared. The result is a diagram whose edges are as accurate as the configuration, which is a much stronger guarantee than anything derived from reading application code.
Configuration or state
Reading .tf files gives you what should exist. Pointing it at a state file or a saved plan gives you what does. Those differ more often than anyone likes, usually because something was changed by hand, and knowing which question you are asking is worth being deliberate about.
Modules are followed
A diagram of a root module that shows module blocks as opaque boxes is not much use. Module sources are followed so the components inside them appear, which is what makes the output a diagram of the infrastructure rather than of the file layout.
Fidelity
| Comes through | Does not | |
|---|---|---|
| Resources | Every declared resource | Anything created outside Terraform |
| Dependencies | References and depends_on | Runtime coupling not expressed in config |
| Modules | Followed to source and expanded | Remote modules not fetched locally |
| count and for_each | One logical component | Not expanded per instance |
| Variables | Resolved where defaults exist | Values supplied at apply time |
| Providers | Mapped to the external tier | Provider-side behaviour |
The command
Questions
Does it run terraform plan?
No. It reads files, and will use a plan or state file if you point it at one. Nothing executes and no credentials are needed.
Does it work with Pulumi or CloudFormation?
Yes. Terraform has its own page because HCL's reference structure makes the edges unusually reliable, not because the others are unsupported.
Can it show cost?
No. Infracost and your provider's calculator are the right tools for that.
Related
- Convert Mermaid to ExcalidrawUseful when a Mermaid diagram has outgrown what Mermaid's layout can render legibly.
- Convert SQL to an ER DiagramForeign keys already encode the relationships and their cardinality. The diagram renders what the schema is enforcing anyway.
- Convert OpenAPI to a Sequence DiagramThe spec supplies the operations and their exact names. You supply the ordering, because a spec describes endpoints and not journeys.
- Convert Docker Compose to a DiagramA Compose file is a complete description of a small system written in a format that hides its shape.
Last updated