Skip to main content

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

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.

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 files

0.3.4

2 files

0.3.3

2 files

0.3.0

2 files

0.2.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page