Skip to main content

An interactive TUI for Terraform and OpenTofu beginners with enterprise-grade features

Project description

infra-guide ๐Ÿš€

License: MIT Python 3.8+ Version

infra-guide is a production-grade, interactive terminal UI (TUI) tool for Terraform and OpenTofu that combines beginner-friendly guidance with enterprise-level features. Learn infrastructure-as-code while using professional tools like drift detection, policy validation, and CI/CD integration.

โœจ Features

Core Features

  • ๐ŸŽฏ Auto-Detection: Automatically detects whether you have Terraform or OpenTofu installed
  • ๐Ÿ“š Interactive Guides: Detailed explanations for each command before execution
  • ๐ŸŽจ Beautiful TUI: Rich, colorful interface with a modern dark theme
  • โšก No Setup Required: No cloud credentials, no network calls, no telemetry
  • ๐Ÿ›ก๏ธ Safety First: Confirmation prompts and warnings before destructive operations
  • ๐Ÿ“– Beginner-Friendly: Best practices and common flags explained clearly

Enterprise Features (v0.2.0) ๐Ÿ†•

  • ๐Ÿ” Drift Detection: Automatically detect when infrastructure has drifted from state
  • โœ… Pre-Flight Validation: Comprehensive checks before executing commands
  • ๐Ÿ“ฆ State Explorer: Interactive browser for exploring state files with tree view
  • ๐Ÿ“ Workspace Manager: Easy management of multiple environments
  • ๐Ÿš€ CI/CD Mode: Non-interactive pipeline mode for automation
  • ๐Ÿ“Š Resource Visualization: View resources by type with detailed statistics
  • ๐Ÿ”„ Smart Validation: Syntax checking, format validation, and configuration analysis

๐ŸŽฌ Demo

๐Ÿš€ infra-guide - Interactive Infrastructure Guide
๐Ÿ“ฆ Using: terraform (v1.6.0)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Main Menu - Enhanced Edition โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Option  Command      Description                                     โ”‚
โ”‚ 1       init         ๐Ÿ”ง Initialize a working directory               โ”‚
โ”‚ 2       plan         ๐Ÿ“‹ Show changes required                        โ”‚
โ”‚ 3       apply        โœ… Create or update infrastructure              โ”‚
โ”‚ 4       destroy      ๐Ÿ’ฅ Destroy infrastructure                       โ”‚
โ”‚ 5       validate     โœ“ Run pre-flight validations                   โ”‚
โ”‚ 6       drift        ๐Ÿ” Detect infrastructure drift                  โ”‚
โ”‚ 7       state        ๐Ÿ“ฆ Explore state file                           โ”‚
โ”‚ 8       workspace    ๐Ÿ“ Manage workspaces                            โ”‚
โ”‚ 9       cicd         ๐Ÿš€ CI/CD pipeline mode                          โ”‚
โ”‚ 0       exit         ๐Ÿšช Exit infra-guide                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Select an option [1/2/3/4/5] (5):

๐Ÿ“‹ Prerequisites

Before installing infra-guide, ensure you have:

  1. Python 3.8 or higher

    python3 --version
    
  2. Either Terraform OR OpenTofu (at least one required)

That's it! No cloud credentials, API keys, or additional setup needed.

๐Ÿš€ Installation

Option 1: Install with pipx (Recommended)

pipx is the recommended way to install command-line tools in isolated environments. It's available for macOS, Linux, and Windows.

Install pipx:

  • macOS: brew install pipx
  • Linux (Ubuntu/Debian): sudo apt install pipx or pipx via package manager
  • Windows: scoop install pipx or choco install pipx or download from PyPA

Install infra-guide:

pipx install infra-guide

Verify installation:

infra-guide --help

Option 2: Install from Source

# Clone the repository
git clone https://github.com/iamtejas23/infra-guide.git
cd infra-guide

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install the package
pip install .

# Run the tool
infra-guide

Option 3: Install from GitHub (Development Version)

# Install directly from GitHub using pipx
pipx install git+https://github.com/iamtejas23/infra-guide.git

# Or from source directory
git clone https://github.com/iamtejas23/infra-guide.git
cd infra-guide
pip install -e .

๐Ÿ“– Usage

Simply run the command from any directory containing Terraform/OpenTofu configuration files:

infra-guide

Navigation

  • Use number keys (1-5) to select menu options
  • Follow the on-screen prompts
  • Read the guides before executing commands
  • Confirm when prompted before any command execution

Example Workflow

Basic Workflow:

  1. Initialize your project - Select option 1 (init)
  2. Validate configuration - Select option 5 (validate) for pre-flight checks
  3. Preview changes - Select option 2 (plan)
  4. Apply changes - Select option 3 (apply)

Advanced Workflow:

  1. Check for drift - Select option 6 (drift) to detect changes outside Terraform
  2. Explore state - Select option 7 (state) to view current infrastructure
  3. Manage environments - Select option 8 (workspace) to switch between dev/staging/prod
  4. Run CI/CD pipeline - Select option 9 (cicd) for automated validation

๐ŸŽฏ Supported Commands

Command Description Risk Level New in v0.2.0
init Initialize working directory ๐ŸŸข Low
plan Preview infrastructure changes ๐ŸŸข Low
apply Create/update infrastructure ๐ŸŸก Medium
destroy Delete all infrastructure ๐Ÿ”ด High
validate Run pre-flight checks ๐ŸŸข Low โœ…
drift Detect infrastructure drift ๐ŸŸข Low โœ…
state Explore state file ๐ŸŸข Low โœ…
workspace Manage workspaces ๐ŸŸก Medium โœ…
cicd Run CI/CD pipeline ๐ŸŸก Medium โœ…

๏ฟฝ Feature Deep Dive

๐Ÿ” Drift Detection

Automatically detects when your actual infrastructure has diverged from the state file. This happens when changes are made outside of Terraform/OpenTofu (manual changes, other tools, etc.).

# In infra-guide, select option 6
# Shows which resources have drifted and what changed

โœ… Pre-Flight Validation

Runs comprehensive checks before you execute commands:

  • Configuration file existence
  • Initialization status
  • Syntax validation
  • Code formatting
  • Backend configuration
  • Provider version locks
  • Required variables

๐Ÿ“ฆ State Explorer

Interactive browser for your state file:

  • Overview: Total resources and types
  • Resource List: All resources with addresses
  • Tree View: Hierarchical visualization by resource type

๐Ÿ“ Workspace Manager

Easily manage multiple environments:

  • List all workspaces
  • Switch between workspaces
  • Create new workspaces
  • Delete unused workspaces
  • Visual indication of current workspace

๐Ÿš€ CI/CD Pipeline Mode

Non-interactive mode perfect for automation:

  • Runs init โ†’ validate โ†’ plan automatically
  • Uses detailed exit codes
  • No user prompts
  • Designed for continuous integration

๏ฟฝ๐Ÿ”’ Security & Privacy

  • No Telemetry: We don't collect any data
  • No Network Calls: Works completely offline
  • No Credentials Required: Only wraps Terraform/OpenTofu CLI
  • Open Source: Fully transparent, auditable code
  • Local Execution: All commands run locally on your machine

๐Ÿ› ๏ธ Development

Setting Up Development Environment

# Clone the repository
git clone https://github.com/iamtejas23/infra-guide.git
cd infra-guide

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode with dev dependencies
pip install -e ".[dev]"

Running Tests

pytest

Code Formatting

black infra_guide/

Type Checking

mypy infra_guide/

๐Ÿ“ Project Structure

infra-guide/
โ”œโ”€โ”€ infra_guide/
โ”‚   โ”œโ”€โ”€ __init__.py          # Package initialization
โ”‚   โ”œโ”€โ”€ cli.py               # Main CLI entry point
โ”‚   โ”œโ”€โ”€ detector.py          # Tool detection logic
โ”‚   โ”œโ”€โ”€ ui.py                # UI components using rich
โ”‚   โ”œโ”€โ”€ runner.py            # Command execution
โ”‚   โ””โ”€โ”€ guides/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ init.py          # Init command guide
โ”‚       โ”œโ”€โ”€ plan.py          # Plan command guide
โ”‚       โ”œโ”€โ”€ apply.py         # Apply command guide
โ”‚       โ””โ”€โ”€ destroy.py       # Destroy command guide
โ”œโ”€โ”€ pyproject.toml           # Project configuration
โ”œโ”€โ”€ README.md                # This file
โ””โ”€โ”€ LICENSE                  # MIT License

๐Ÿ—บ๏ธ Roadmap

Completed โœ…

  • Core IaC commands (init, plan, apply, destroy)
  • Drift detection
  • Pre-flight validations
  • State explorer with tree visualization
  • Workspace management
  • CI/CD pipeline mode
  • Comprehensive error handling

Coming Soon

  • Policy-as-code integration (OPA, Sentinel)
  • Cost estimation before apply
  • Graph visualization of resource dependencies
  • Plan diff with syntax highlighting
  • Custom command templates
  • Configuration file for user preferences
  • Color theme customization
  • Command history and favorites
  • Export reports to markdown/PDF
  • Integration with popular CI/CD platforms
  • Multi-language support
  • Cloud provider-specific guidance
  • Terraform/OpenTofu module browser

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and formatting
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with Rich for beautiful terminal output
  • Inspired by the need to make Infrastructure as Code more accessible to beginners
  • Thanks to the Terraform and OpenTofu communities

๐Ÿ“ž Support

โญ Star History

If you find this project useful, please consider giving it a star on GitHub!


Made 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

infra_guide-0.2.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

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

infra_guide-0.2.0-py3-none-any.whl (31.9 kB view details)

Uploaded Python 3

File details

Details for the file infra_guide-0.2.0.tar.gz.

File metadata

  • Download URL: infra_guide-0.2.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for infra_guide-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ac05096361f66210d43e67f4bf2fd79f24a6ccccc24547bf788119e319bcf836
MD5 4d130fa37521ad80742a537f709c6c63
BLAKE2b-256 23f5ac8df444d98971035cecfc76857aa06af8d601785aaebb4101329ab2e82a

See more details on using hashes here.

File details

Details for the file infra_guide-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: infra_guide-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for infra_guide-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4173ccf28bd75e6242f689e079bf5b903e2627d33658f91c56331289fd8f778
MD5 c858c525f3f40875b415ab4508d52890
BLAKE2b-256 d94fe5c6f05ed975284561c814caaecc3aebb0f59678c85f738fae656e847180

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