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.4.tar.gz (16.9 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.4-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tofu_tree-0.3.4.tar.gz
  • Upload date:
  • Size: 16.9 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.4.tar.gz
Algorithm Hash digest
SHA256 b015ffd645a70cdfd745e3922bc5fa8377e705cdf73b2f335dddd4470a40065b
MD5 04213bfd605aa575111f02b113ebd009
BLAKE2b-256 981316dca6fa80c1e19421c1937814873c54eb38202ba5c0a7c44bc7380211cb

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tofu_tree-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 13.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a5d3b3eb3d0738552c424f17cf19fb7b08a643711a9195de438c05a057007a71
MD5 bf8b36b86c13fe4877e6c44ece663f56
BLAKE2b-256 397cddcf90d10e1f4fa4b882fe95ab9f1951847a36de07a5c71f0b839bc4f7ad

See more details on using hashes here.

Provenance

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