Working with Terraform I wanted to know if there was a way to document the coded infrastructure to get a better understanding of what we had in our repo. Turns out you can. To do so you’ll need to install Graphviz which can be done using brew:
brew install graphviz
We then use the Terraform cli and pipe the result into Graphviz’s
terraform graph | dot -Tsvg > [path to file].svg
There are multiple options for output from Graphviz like png but I think svg works best for documentation purposes. For more Terraform graph options the
graph command docs has them covered.