thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

Terraform: generate diagrams

β€’ 116 words β€’ 1 min β€’ updated

⚠️ This post is over one year old. It may no longer be up to date or relevant. Opinions may have changed.

There are a few options to visualize a terraform module in the form of a graph or diagram.

terraform graph: dot / graphviz #

terraform graph outputs a DOT graph, which can be manipulated / visualized with graphviz:

terraform graph | dot -Tpng > graph.png

The graph can then be embedded into a markdown file:

README.md markdown
![graph](graph.png)

terramaid: mermaid #

The terramaid project generates Mermaid diagrams from Terraform configurations:

% brew install terramaid
% terramaid run --output README.md
Mermaid diagram successfully written to README.md

The default filename is Terramaid.md.

Why use Mermaid? It was previously covered here.

TL;DR: Mermaid has native integration with GitHub and GitLab, and that’s hard to beat. Graphviz, sadly, does not.