Skip to main content

A beautiful tree visualization tool for Terraform/OpenTofu plan output

Project description

tofu-tree logo

tofu-tree

๐ŸŒณ Simple tree visualization for Terraform/OpenTofu plan output

PyPI version Python versions CI status Coverage License

Transform your terraform plan or tofu plan output into an easy-to-read hierarchical tree structure with color-coded change indicators.


โœจ Features

  • ๐ŸŒณ Beautiful Tree Output โ€” Visualize your Terraform plan as a clean, hierarchical tree
  • ๐ŸŽจ Color-Coded Symbols โ€” Instantly see what's being created (+), destroyed (-), or modified (~)
  • ๐Ÿ”„ Auto-Detection โ€” Automatically finds and runs tofu or terraform in your PATH
  • ๐Ÿ“Š Summary Statistics โ€” Quick overview of total changes at a glance
  • ๐Ÿ“ฆ Zero Dependencies โ€” Pure Python, works out of the box
  • ๐Ÿ–ฅ๏ธ Cross-Platform โ€” Works on Linux, macOS, and Windows

๐Ÿ“ฆ Installation

pip install tofu-tree

Or with pipx for isolated installation:

pipx install tofu-tree

๐Ÿš€ Quick Start

Run in a Terraform/OpenTofu directory

cd your-terraform-project
tofu-tree

Pipe plan output directly

tofu plan -concise -no-color | tofu-tree --input

Specify a directory

tofu-tree /path/to/terraform/project

๐Ÿ“– Usage

usage: tofu-tree [-h] [-V] [--no-color] [--input] [path]

Parse Terraform/OpenTofu plan output and display as a beautiful tree

positional arguments:
  path           Path to the Terraform/OpenTofu directory (default: current directory)

options:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit
  --no-color     Disable ANSI color output for symbols (color is enabled by default)
  --input, -i    Read plan output from stdin instead of running terraform/tofu plan

๐ŸŽฌ Example Output

+ local_file
โ”‚  โ”œโ”€โ”€ + config_files
โ”‚  โ”‚   โ”œโ”€โ”€ + config_files: app
โ”‚  โ”‚   โ”œโ”€โ”€ + config_files: cache
โ”‚  โ”‚   โ””โ”€โ”€ + config_files: db
โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€ + nested_docs
โ”‚  โ”‚   โ”œโ”€โ”€ + nested_docs: changelog
โ”‚  โ”‚   โ”œโ”€โ”€ + nested_docs: license
โ”‚  โ”‚   โ””โ”€โ”€ + nested_docs: readme
โ”‚  โ”‚
โ”‚  โ””โ”€โ”€ + scripts
โ”‚      โ”œโ”€โ”€ + scripts: backup
โ”‚      โ””โ”€โ”€ + scripts: deploy
โ”‚
+ module.nested_module
โ”‚  โ””โ”€โ”€ + local_file
โ”‚      โ”œโ”€โ”€ + health_checks
โ”‚      โ”‚   โ”œโ”€โ”€ + health_checks: api
โ”‚      โ”‚   โ”œโ”€โ”€ + health_checks: web
โ”‚      โ”‚   โ””โ”€โ”€ + health_checks: worker
โ”‚      โ”‚
โ”‚      โ”œโ”€โ”€ + service_configs
โ”‚      โ”‚   โ”œโ”€โ”€ + service_configs: api
โ”‚      โ”‚   โ”œโ”€โ”€ + service_configs: web
โ”‚      โ”‚   โ””โ”€โ”€ + service_configs: worker
โ”‚      โ”‚
โ”‚      โ””โ”€โ”€ + service_deployments
โ”‚          โ”œโ”€โ”€ + service_deployments: api
โ”‚          โ”œโ”€โ”€ + service_deployments: web
โ”‚          โ””โ”€โ”€ + service_deployments: worker
โ”‚

+ 20 resources to be created
-  0 resources to be destroyed
~  0 resources to be replaced/updated

Symbol Legend

Symbol Color Meaning
+ ๐ŸŸข Green Resource will be created
- ๐Ÿ”ด Red Resource will be destroyed
~ ๐ŸŸก Yellow Resource will be modified/replaced

๐Ÿ”ง How It Works

  1. Parse โ€” Reads Terraform/OpenTofu plan output (concise format with -concise flag)
  2. Build โ€” Constructs a hierarchical graph from resource addresses
  3. Display โ€” Renders the graph as a tree with proper connectors (โ”œโ”€โ”€, โ””โ”€โ”€)
  4. Summarize โ€” Shows counts of created, destroyed, and modified resources

๐Ÿค Contributing

Contributions are welcome! Here's how to get started:

# Clone the repository
git clone https://github.com/yourusername/tofu-tree.git
cd tofu-tree

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linter
ruff check src tests

# Run type checker
mypy src/tofu_tree

๐Ÿ“„ License

Hippocratic License 3.0 โ€” see LICENSE for details.

This license includes ethical restrictions, including a prohibition on using this software to train artificial intelligence systems without explicit permission.

๐Ÿ™ Acknowledgments

Inspired by the Unix tree command and the need for better Terraform plan visualization.


Vibe Coded with โค๏ธ for the Infrastructure as Code community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tofu_tree-0.2.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tofu_tree-0.2.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file tofu_tree-0.2.1.tar.gz.

File metadata

  • Download URL: tofu_tree-0.2.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tofu_tree-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9f855e60643575c26499ca0d105742a0d9c9abd22d0ef250fce41e2d57572555
MD5 5d1a19ca152a08dfedf0b9dc64883df2
BLAKE2b-256 ab15165a2dff6a6ac0ce234ba9799f770d2482d82ac0ea46d9abb0e7a2fd99ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for tofu_tree-0.2.1.tar.gz:

Publisher: publish.yml on Samet-MohamedAmin/tofu-tree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tofu_tree-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: tofu_tree-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tofu_tree-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 517618e49a5c4f258fb21c709dd90716663708d7a03e67c1d75e1015d8d80bde
MD5 d9efbbbfaeb6363e006c6c08addf47e5
BLAKE2b-256 08710c942dd0e8199c9b744fcdc9ca2fecc65120eb569a486c05955942af24a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tofu_tree-0.2.1-py3-none-any.whl:

Publisher: publish.yml on Samet-MohamedAmin/tofu-tree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page