An interactive TUI for Terraform and OpenTofu beginners with enterprise-grade features
Project description
infra-guide ๐
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:
-
Python 3.8 or higher
python3 --version -
Either Terraform OR OpenTofu (at least one required)
- Terraform: Download and Install
- OpenTofu: Download and Install
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 pipxorpipxvia package manager - Windows:
scoop install pipxorchoco install pipxor 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:
- Initialize your project - Select option 1 (init)
- Validate configuration - Select option 5 (validate) for pre-flight checks
- Preview changes - Select option 2 (plan)
- Apply changes - Select option 3 (apply)
Advanced Workflow:
- Check for drift - Select option 6 (drift) to detect changes outside Terraform
- Explore state - Select option 7 (state) to view current infrastructure
- Manage environments - Select option 8 (workspace) to switch between dev/staging/prod
- 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:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and formatting
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
- ๐ซ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ Documentation: GitHub Wiki
โญ 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac05096361f66210d43e67f4bf2fd79f24a6ccccc24547bf788119e319bcf836
|
|
| MD5 |
4d130fa37521ad80742a537f709c6c63
|
|
| BLAKE2b-256 |
23f5ac8df444d98971035cecfc76857aa06af8d601785aaebb4101329ab2e82a
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4173ccf28bd75e6242f689e079bf5b903e2627d33658f91c56331289fd8f778
|
|
| MD5 |
c858c525f3f40875b415ab4508d52890
|
|
| BLAKE2b-256 |
d94fe5c6f05ed975284561c814caaecc3aebb0f59678c85f738fae656e847180
|