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

$ tofu-tree .
+ local_file.bla

+ local_file.config_files
โ”‚  โ”œโ”€โ”€ + app
โ”‚  โ”œโ”€โ”€ + cache
โ”‚  โ””โ”€โ”€ + db
โ”‚      
+ module.nested_module
โ”‚  โ”œโ”€โ”€ + local_file.health_checks
โ”‚  โ”‚   โ”œโ”€โ”€ + api
โ”‚  โ”‚   โ”œโ”€โ”€ + web
โ”‚  โ”‚   โ””โ”€โ”€ + worker
โ”‚  โ”‚       
โ”‚  โ”œโ”€โ”€ + local_file.service_configs
โ”‚  โ”‚   โ”œโ”€โ”€ + api
โ”‚  โ”‚   โ”œโ”€โ”€ + web
โ”‚  โ”‚   โ””โ”€โ”€ + worker
โ”‚  โ”‚       
โ”‚  โ””โ”€โ”€ + local_file.service_deployments
โ”‚      โ”œโ”€โ”€ + api
โ”‚      โ”œโ”€โ”€ + web
โ”‚      โ””โ”€โ”€ + worker
โ”‚          

+  13 to be created
-   0 to be destroyed
ยฑ   0 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.5.tar.gz (18.4 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.5-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tofu_tree-0.3.5.tar.gz
  • Upload date:
  • Size: 18.4 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.5.tar.gz
Algorithm Hash digest
SHA256 9f2b08096052e02665f64e0f01a4a8460c8bdcd250b6735c569a07fb97433056
MD5 eef1d1fc5000c715af4896d8aa41bdb3
BLAKE2b-256 67ecd8488c919017cfc06e9aa3cebe4555aac4a3e43437d5e1a36b30eaf45ef8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tofu_tree-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 15.1 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bd70aad78afe7abad8ed0422932bdad62df3ac56c88777de5b148f1a5caab3a6
MD5 82f467bc9074e2968834be8792b93e5c
BLAKE2b-256 d71dbd7381f363578b39ee0ff2379d9ea394bf0792ca25d81284c8135bc7e4d4

See more details on using hashes here.

Provenance

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