Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 1.89 KB

File metadata and controls

63 lines (42 loc) · 1.89 KB

🛠️ Terraform Plan Visualizer - tfviz

Reading a large terraform plan output in JSON can be overwhelming, especially in complex infrastructures.
tfviz is a simple CLI tool that takes terraform show -json output and generates a clean, visual HTML report.
It summarizes key statistics and shows changes grouped by module and resource, making it easier to understand and share with your team.

Image

⚙️ Requirements

  • Go 1.18 or higher
  • Terraform 0.12 or higher
  • Terraform plan output in JSON format (terraform show -json)

⚙️ Usage

1. Install Go

Make sure Go is installed on your system.

2. Build the binary

go build -o tfviz main.go

3. (Optional) Move to global path

sudo mv tfviz /usr/local/bin/

4. (Optional) Change the default port (9876)

By default, tfviz runs on port 9876. To change it, modify the port variable in the serveHTMLOnce function inside main.go:

func serveHTMLOnce(html string) {
    port := "9876" // ← Change this if needed
    ...
}

5. Visualize your Terraform plan

In your Terraform project directory:

tfviz plan

This will start a temporary local web server and automatically open your default browser to show the visualized plan.

To see a dependency graph of your resources, use the --graph or -g flag:

tfviz plan --graph
image

No HTML file is written to disk — everything runs in memory.

The server automatically shuts down 5 seconds after the page has been opened, regardless of whether the browser is still open or not.