Overview
infra-guide is a free, open-source CLI and interactive TUI for Terraform and OpenTofu. It combines a guided menu for beginners with direct subcommands for production use — both powered by the same engine.
Beyond being a menu wrapper, infra-guide adds capabilities that raw Terraform doesn't include: Doctor diagnostics, a built-in security policy engine, a local browser command center, cost insight from plan JSON, drift detection, 5 visual themes, shell completion, and CI/CD pipeline mode.
No telemetry
Zero data collection, works fully offline
No credentials needed
Only wraps your local Terraform / OpenTofu binary
Auto-detects binary
Finds Terraform or OpenTofu automatically
MIT License
Free forever, source code on GitHub
Prerequisites
Before installing infra-guide, you need the following on your system:
| Requirement | Version | Check |
|---|---|---|
| Python | 3.8+ | python3 --version |
| Terraform or OpenTofu | Any | terraform version |
Install Terraform or OpenTofu
You only need one of these — infra-guide auto-detects which one is available.
Installation
pip (standard)
The simplest way — works on any system with Python 3.8+.
pip install infra-guidepipx (recommended)
pipx installs infra-guide in an isolated environment so it never conflicts with other Python packages.
# Install pipx if you don't have it
pip install pipx
# Install infra-guide
pipx install infra-guideFrom source
git clone https://github.com/cloudgrains/infra-guide.git
cd infra-guide
pip install .Verify installation
infra-guide --versioninfra-guide is not found after install, ensure ~/.local/bin is in your $PATH. Run python3 -m site --user-base to find the install location.Quick Start
Run these four commands from any directory containing Terraform or OpenTofu configuration files to get oriented immediately.
infra-guideOpen the interactive TUI dashboard
infra-guide doctorWorkspace health check — validate config, detect drift
infra-guide policyRun built-in security policy checks on your plan
infra-guide webOpen a browser command center at localhost:8765
infra-guide doctor before anything else. It tells you exactly what's missing, what's configured wrong, and whether drift has been detected — all in one command.Doctor Mode
Doctor mode runs a full workspace health audit. It validates your configuration, checks the backend, counts variables, verifies provider locks, and — optionally — detects infrastructure drift, all in a single command.
# Basic health check
infra-guide doctor
# Health check + drift detection
infra-guide doctor --with-driftWhat it checks
| Check | What it verifies |
|---|---|
| Terraform / OpenTofu detected | Binary found in PATH, version reported |
| Backend configured | backend block present in config |
| Providers locked | .terraform.lock.hcl exists |
| Variables set | All required variables have values |
| Workspace | Current workspace name shown |
| Drift (--with-drift) | State vs actual infra compared |
Example output
$ infra-guide doctor ⚕ Workspace Health ✔ Terraform v1.6.0 detected ✔ Backend configured S3 ✔ Providers locked .terraform.lock.hcl ✔ Variables set 10 / 10 ⚠ Drift detected 2 resources changed Run `infra-guide plan` to see full diff
infra-guide plan to see what changed before applying anything. Applying over drifted state can cause unexpected resource recreation.Policy Checks
infra-guide ships a built-in security policy engine. Run infra-guide policy to check your Terraform plan against six security rules — no external tools required.
# Check against saved plan file
infra-guide policy --plan-file tfplan.json
# Run policy check interactively
infra-guide policyBuilt-in policies
| Policy | What it catches |
|---|---|
| no-public-s3 | S3 buckets with public access enabled |
| no-public-ingress | Security groups with 0.0.0.0/0 ingress |
| require-tags | Resources missing required tags |
| require-encryption | Storage resources without encryption |
| s3-versioning | S3 buckets without versioning enabled |
| no-default-vpc | Resources deployed into the default VPC |
infra-guide plan --out tfplan, then run policy checks with infra-guide policy --plan-file tfplan.json.Web Command Center
infra-guide web launches a local browser interface powered by the same backend as the TUI. Everything you can do in the terminal, you can do from a browser tab.
# Start on default port 8765
infra-guide web
# Use a custom port
infra-guide web --port 9000
# Start server without opening browser
infra-guide web --no-browserThe web UI opens automatically at http://localhost:8765. It shows a dashboard with your workspace status, recent commands, and buttons to run all infra-guide operations.
localhost only. It is not exposed to the network and has no authentication — never port-forward or proxy it to a public interface.Drift Detection
Drift occurs when someone modifies cloud resources directly (via the console, CLI, or another tool) without updating Terraform. infra-guide can detect this automatically.
# Standalone drift check
infra-guide drift
# Combined with health diagnostics
infra-guide doctor --with-driftWhen drift is detected, infra-guide shows which resources changed and what properties differ from the state file. From there, you can run infra-guide plan to see the full diff and decide whether to apply or import the manual changes.
infra-guide doctor --with-drift as your daily pre-flight — it combines the health audit and drift check in a single run.Cost Insight
When you apply with a saved plan file, infra-guide analyses the plan JSON and surfaces AWS cost-impact hints before any changes run. This gives you a rough estimate of what the change will cost before it's irreversible.
# 1. Save a plan
infra-guide plan --out tfplan
# 2. Apply with cost hints shown automatically
infra-guide apply --plan-file tfplan --yesThemes
infra-guide ships with five visual themes. Your selected theme persists across sessions.
aurora
Default. Blue/purple gradient
sunset
Warm orange/red tones
forest
Natural green palette
mono
Monochrome — minimal noise
neon
High-contrast cyberpunk
Switching themes
# Set theme (persists across sessions)
infra-guide theme --set neon
# List available themes
infra-guide theme --list
# Reset to default (aurora)
infra-guide theme --resetShell Completion
infra-guide supports tab completion for bash, zsh, and fish. Setup is a one-time operation per shell.
bash
infra-guide completion bash >> ~/.bashrc
source ~/.bashrczsh
infra-guide completion zsh >> ~/.zshrc
source ~/.zshrcfish
infra-guide completion fish > ~/.config/fish/completions/infra-guide.fishAfter setup, press Tab after typing infra-guide to see available subcommands, flags, and their descriptions.
Command History & Favorites
infra-guide logs all commands you run and lets you pin frequently-used ones as favorites.
# View recent command history
infra-guide history
# View favorites only
infra-guide history --favoritesFrom the history view you can re-run any previous command, add it to favorites, or remove old entries. Favorites are accessible from the TUI main menu.
CI/CD Mode
infra-guide cicd runs a pipeline-safe init → validate → plan sequence in non-interactive mode with machine-readable exit codes. No prompts, no TUI, no user interaction required.
# Run CI/CD pipeline
infra-guide cicd
# Exit codes:
# 0 — success, plan shows no changes
# 1 — error (config/init failure)
# 2 — success, plan shows changes (standard Terraform behavior)GitHub Actions example
- name: infra-guide CI
run: |
pip install infra-guide
infra-guide cicd
env:
TF_VAR_region: us-east-1Workspaces
Workspaces let you manage multiple environments (dev, staging, prod) from the same configuration. infra-guide wraps Terraform's workspace commands with a cleaner interface.
# List all workspaces (current marked with *)
infra-guide workspace --list
# Create a new workspace
infra-guide workspace --new staging
# Switch to a workspace
infra-guide workspace --select production
# Delete a workspace
infra-guide workspace --delete old-envdefault workspace is blocked by Terraform — infra-guide will warn you before attempting this.State Explorer
Explore your Terraform state file without editing it directly. The state explorer shows resources in list, tree, or detail view.
# Overview — resource count by type
infra-guide state
# Tree view — hierarchical by resource type
infra-guide state --tree
# Detailed view of one resource
infra-guide state --show aws_instance.webState explorer is read-only — it never modifies your state file. Use it to audit what Terraform knows about, find resource addresses, and understand your current infrastructure without running terraform state list manually.
All Commands
Complete reference for every infra-guide subcommand.
| Command | Description | Risk |
|---|---|---|
infra-guide | Open interactive TUI dashboard | Low |
infra-guide doctor | Workspace health diagnostics | Low |
infra-guide doctor --with-drift | Health check + drift detection | Low |
infra-guide status | Fast workspace summary panel | Low |
infra-guide init | Initialize providers, modules, backend | Low |
infra-guide plan | Preview changes | Low |
infra-guide plan --out tfplan | Preview and save plan to file | Low |
infra-guide apply | Apply changes | Medium |
infra-guide apply --plan-file tfplan --yes | Apply with cost insight | Medium |
infra-guide destroy --yes | Delete managed infrastructure | High |
infra-guide policy | Run built-in security policy checks | Low |
infra-guide drift | Detect infrastructure drift | Low |
infra-guide state --tree | Explore state file | Low |
infra-guide output | Show output values | Low |
infra-guide web | Launch browser command center | Low |
infra-guide workspace --list | List / manage workspaces | Low |
infra-guide theme --set neon | Change active theme | Low |
infra-guide cicd | Pipeline-safe init → validate → plan | Medium |
infra-guide fmt | Format HCL files | Low |
infra-guide validate | Pre-flight validation | Low |
infra-guide history | Recent commands and favorites | Low |
infra-guide completion bash | Shell completion setup | Low |
FAQ
Does infra-guide work with OpenTofu?
Yes. infra-guide automatically detects whether Terraform or OpenTofu is installed and uses the correct binary. All commands work identically with both tools.
Does infra-guide need internet access?
No. infra-guide works completely offline. It does not call any external APIs, collect telemetry, or require an account. The web command center (infra-guide web) also runs entirely on localhost.
What's the difference between infra-guide and running Terraform directly?
infra-guide adds capabilities you don't get from raw Terraform: Doctor diagnostics, built-in policy checks, drift detection in a single command, cost insight before apply, a browser UI, 5 themes, shell completion, command history, and a guided TUI for beginners — all offline.
Is infra-guide free?
Yes, completely free and open source under the MIT License. No paid tiers, no SaaS fees, no API keys.
infra-guide is not found after pip install — how do I fix this?
The pip user scripts directory may not be in your PATH. Run python3 -m site --user-base to find it, then add <user-base>/bin to your PATH in ~/.bashrc or ~/.zshrc. Using pipx install infra-guide avoids this entirely.
Contributing
Contributions are welcome. Here's how to get started:
# 1. Fork and clone
git clone https://github.com/cloudgrains/infra-guide.git
cd infra-guide
# 2. Create virtual environment
python3 -m venv venv
source venv/bin/activate
# 3. Install in dev mode
pip install -e ".[dev]"
# 4. Run tests
pytest
# 5. Format code
black infra_guide/Open a Pull Request from your fork targeting the main branch. Please include test coverage for new features.