Skip to main content

Terraform Project Tree Generator CLI Tool

Project description

๐Ÿš€ TFTree --- Terraform Project Tree Generator CLI

A professional-grade CLI tool to generate clean, structured, and shareable Terraform project trees --- with smart exclude support, colored output, and Markdown export.


Python License CLI Terraform


๐Ÿ“Œ Why TFTree?

Terraform projects often include:

  • .terraform/
  • terraform.tfstate
  • .terraform.lock.hcl
  • .git/
  • Provider binaries
  • Deeply nested modules

Sharing structure manually becomes messy and unreadable.

๐Ÿ”ฅ TFTree solves this problem by generating a clean, structured tree view of your infrastructure project --- ready for documentation, sharing, and audits.


โœจ Features

โœ… 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


๐Ÿ“ฆ Installation

๐Ÿ”น Local Install (Development Mode)

python -m pip install -e .

๐Ÿ”น Standard Install

python -m pip install .

๐Ÿ”น After PyPI Publish (Global Install)

pip install tftree

๐Ÿš€ Usage

Basic Usage

tftree <project-folder>

Example:

tftree .

๐Ÿ“ Structure Only (No File Content)

tftree . --no-content

๐Ÿšซ Exclude Files & Folders

Direct Patterns

tftree . --exclude .terraform .git terraform.tfstate *.exe

Using Exclude File

tftree . --exclude-file exclude.txt

Example exclude.txt:

.terraform
.git
terraform.tfstate
*.exe
.terraform.lock.hcl

Supported:

  • Exact file names
  • Folder names
  • Wildcards

๐Ÿ’พ Save Output to File

tftree . -o infra_tree.txt

๐Ÿ“ Markdown Export Mode

Generate Markdown-ready structure:

tftree . --markdown -o structure.md

Perfect for:

  • GitHub documentation
  • Wiki pages
  • Confluence
  • Client documentation

๐Ÿ–ฅ Example Output

๐Ÿ“ Terraform Project: infra

โ”œโ”€โ”€ ๐Ÿ“ modules
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ main.tf
โ”‚   โ”‚   resource "azurerm_resource_group" "rg" {
โ”‚   โ”‚       name     = "example"
โ”‚   โ”‚       location = "East US"
โ”‚   โ”‚   }
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ variables.tf
โ”‚       variable "location" {
โ”‚           type = string
โ”‚       }
โ””โ”€โ”€ ๐Ÿ“„ provider.tf

โš™๏ธ CLI Options

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


๐Ÿ— Project Structure

tftree/
โ”‚
โ”œโ”€โ”€ tftree/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ cli.py
โ”‚
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

๐Ÿ”ฅ DevOps Use Cases

  • Share Terraform structure in tickets
  • Infrastructure documentation
  • CI/CD pipeline documentation
  • Client infrastructure overview
  • Audit reporting
  • Pre-deployment reviews

๐ŸŒ PyPI Publishing

Once published to PyPI, anyone can install globally:

pip install tftree

This makes TFTree a globally accessible DevOps utility tool.


๐Ÿง  Roadmap

  • .treeignore auto-detection
  • --max-depth option
  • Terraform-only mode (*.tf)
  • JSON export
  • GitHub Action integration
  • Auto documentation mode

๐Ÿ‘จโ€๐Ÿ’ป Author

Ritesh Sharma
DevOps | Azure | Terraform | Kubernetes


๐Ÿ“„ License

MIT License


โญ Support

If you find this tool useful:

โญ Star the repository
๐Ÿš€ Share with DevOps community
๐Ÿ›  Contribute improvements


Built with โค๏ธ for DevOps Engineers

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

rtftree-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rtftree-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file rtftree-1.0.0.tar.gz.

File metadata

  • Download URL: rtftree-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rtftree-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2616fefa8563707fa286dc9eca6a4273ca396f510798341eb2491a8d9f6956bb
MD5 f1b50b9d0fca5b24a0d62ae5e24bfaad
BLAKE2b-256 d888ca905a843772f48e7f9719e15d34881abadef500d0d3e3d151d8eb669ab3

See more details on using hashes here.

File details

Details for the file rtftree-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rtftree-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rtftree-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 486fb9c1a8096d9601b4f047fed8510a530519c9716d9762cdf8c3c73efab918
MD5 bde0b52ef8b4b7c5353d6e1dde578291
BLAKE2b-256 99654a63e9fdaa034e5121bfb4083687229ec5a56c4d8584ba04ce16c67dd9ba

See more details on using hashes here.

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