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 (-), replaced (ยฑ), or updated (~)
  • ๐Ÿ”„ 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
โ”‚  โ”œโ”€โ”€ - nested_docs
โ”‚  โ”‚   โ”œโ”€โ”€ - nested_docs: changelog
โ”‚  โ”‚   โ”œโ”€โ”€ - nested_docs: license
โ”‚  โ”‚   โ””โ”€โ”€ - nested_docs: readme
โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€ + nested_docs_2
โ”‚  โ”‚   โ”œโ”€โ”€ + nested_docs_2: changelog
โ”‚  โ”‚   โ”œโ”€โ”€ + nested_docs_2: license
โ”‚  โ”‚   โ””โ”€โ”€ + nested_docs_2: readme
โ”‚  โ”‚
โ”‚  โ””โ”€โ”€ +-ยฑ scripts
โ”‚      โ”œโ”€โ”€ - scripts: backup
โ”‚      โ”œโ”€โ”€ + scripts: create
โ”‚      โ””โ”€โ”€ ยฑ scripts: deploy
โ”‚

+   4 to be created
-   4 to be destroyed
ยฑ   1 to be replaced
~   0 to be updated

screenshot showing tofu-tree output

Symbol Legend

Symbol Color Meaning
+ ๐ŸŸข Green Resource will be created
- ๐Ÿ”ด Red Resource will be destroyed
ยฑ ๐ŸŸฃ Magenta Resource will be replaced (destroy + create)
~ ๐ŸŸก Yellow Resource will be updated in-place

๐Ÿ”ง 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, replaced, and updated 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

If you like the idea please upvote this feature request Add short concise tree view output option for tofu plan #3619

๐Ÿ“„ 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.3.0.tar.gz (16.8 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.3.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tofu_tree-0.3.0.tar.gz
  • Upload date:
  • Size: 16.8 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.3.0.tar.gz
Algorithm Hash digest
SHA256 7451515dc762dc8a0bcf0a6fb7d74e0a29891285be92ffec2e6a07e42369fac7
MD5 65394fd976fd484723c87a94fb515493
BLAKE2b-256 9fec4fa3fb241371f9819a1549b17599b889f0a622f10c9d2362671e1d89cf1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tofu_tree-0.3.0.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: tofu_tree-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f745a9802af3716bdc3ab9c598e7654972457369b7249ff88262fe1e891a742f
MD5 82bc705c2c134ce03d07cc29535559d2
BLAKE2b-256 8784c12ee8bf53061a24a09e284d59982ba5404774f6b4f15357a918cc267305

See more details on using hashes here.

Provenance

The following attestation bundles were made for tofu_tree-0.3.0-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