Generate PlantUML Images from a Terraform State file.
See Examples for Terraform samples and their image outputs.
Take precautions when using State files (as they are open JSON files, most likely with secrets).
This package does NOT require Internet connection to run, nor it stores any parsed info anywhere. Its only effect is to generate two output files: .puml and optionally .png files. Any possible sensitive value is ignored, it can even be redacted beforehand if Security procedures demand so.
Safest way to generate a valid TF State file is to run terraform init, plan & apply
locally, not logged to any real service, using a tool like LocalStack.
npm i -g tfpuml
tfpuml-download-plantuml
, run it to download a copy into this package folder.puml
files using pluginsterraform.tfstate
tfpuml
where your TF state file resides
output.puml
tfpuml --image
to run and export a PNG diagram
java -jar plantuml.jar output.puml
using the PUML file from previous stepoutput.png
tfpuml <input TF state file> <output .puml file>
terraform.tfstate
and output.puml
tfpuml --image
runs the PlantUML visualization graphic lib at the end and outputs an output.png
image filetfpuml --no-check
ignores checking for Terraform Version, use it for state files versions < 1.30 (might run into issues)See tfpuml --help
for further options
Since we're using PlantUML as both input and visualization, it doesn't support intersecting groups - it is a limitation of GraphViz and not really incentivized by PlantUML (or C4 Model) design. For this project it means groups that usually intersect with AZs like Security Groups, Beanstalk or Clusters have to rely on some group repetition.
To avoid cluttering the diagram, some AWS resources are intentionally left out, like Security Groups, IAM policies/roles and CloudWatch Logs.
terraform-aws-modules