A professional-grade CLI tool to generate clean, structured, and shareable Terraform project trees --- with smart exclude support, colored output, and Markdown export.
Terraform projects often include:
.terraform/terraform.tfstate.terraform.lock.hcl.git/- Provider binaries
- Deeply nested modules
Sharing structure manually becomes messy and unreadable.
π₯ rtftree solves this problem by generating a clean, structured tree view of your infrastructure project --- ready for documentation, sharing, and audits.
β
Beautiful tree-style output
β
π¨ Colored CLI output
β
Optional file content preview
β
Smart exclude support (like .gitignore)
β
Wildcard pattern support (*.exe, .terraform*)
β
Exclude via file (--exclude-file)
β
Markdown export mode (--markdown)
β
Output to file (-o)
β
Lightweight & Fast
β
Installable as a CLI tool
python -m pip install -e .python -m pip install .pip install rtftreertftree <project-folder>Example:
rtftree .rtftree . --no-contentrtftree . --exclude .terraform .git terraform.tfstate *.exertftree . --exclude-file exclude.txtExample exclude.txt:
.terraform
.git
terraform.tfstate
*.exe
.terraform.lock.hcl
Supported:
- Exact file names
- Folder names
- Wildcards
rtftree . -o infra_tree.txtGenerate Markdown-ready structure:
rtftree . --markdown -o structure.mdPerfect for:
- GitHub documentation
- Wiki pages
- Confluence
- Client documentation
π Terraform Project: infra
βββ π modules
β βββ π main.tf
β β resource "azurerm_resource_group" "rg" {
β β name = "example"
β β location = "East US"
β β }
β βββ π variables.tf
β variable "location" {
β type = string
β }
βββ π provider.tf
Option Description
--no-content Show only folder/file structure
--exclude Space-separated patterns to ignore
--exclude-file Load exclude patterns from file
--markdown Export output in Markdown format
-o, --output Write output to file
rtftree/
β
βββ rtftree/
β βββ __init__.py
β βββ cli.py
β
βββ pyproject.toml
βββ README.md
- Share Terraform structure in tickets
- Infrastructure documentation
- CI/CD pipeline documentation
- Client infrastructure overview
- Audit reporting
- Pre-deployment reviews
Once published to PyPI, anyone can install globally:
pip install rtftreeThis makes rtftree a globally accessible DevOps utility tool.
.treeignoreauto-detection--max-depthoption- Terraform-only mode (
*.tf) - JSON export
- GitHub Action integration
- Auto documentation mode
Ritesh Sharma
DevOps | Azure | Terraform | Kubernetes
MIT License
If you find this tool useful:
β Star the repository
π Share with DevOps community
π Contribute improvements
Built with β€οΈ for DevOps Engineers