infra-guide
A product-grade CLI and interactive command center for Terraform and OpenTofu. Blends guide-first workflows, direct subcommands, workspace diagnostics, policy checks, and automation-friendly commands — so the tool works equally well for learning and day-to-day operations.
Features
- Interactive TUI dashboard — themed readiness panel, workspace info, recent commands, and favorites
- Direct CLI subcommands —
init,plan,apply,destroy,fmt,state,workspace,cicd,output,policy, and more - Doctor mode — workspace health checks with actionable recommendations and optional drift detection
- Policy checks — built-in security policy engine (no-public-S3, open security groups, missing tags, encryption, versioning)
- Web command center — launch a local browser UI (
infra-guide web) powered by the same backend as the TUI - Themes —
hacker(default CRT/phosphor shell),aurora,sunset,forest,mono,neon— persisted across sessions - Shell completion — one-line setup for bash, zsh, and fish
- Update notifications — background PyPI check after each command, cached for 24 h
- Cost insight — analyzes saved plan JSON for AWS cost-impact hints before
apply - Command history and favorites — rerun support inside the TUI
- Local-only — no telemetry, no credential handling, no cloud calls beyond what your IaC tool makes
Installation
pip install infra-guide
# or
pipx install infra-guide
Quick start
# interactive mode
infra-guide
# direct CLI
infra-guide doctor
infra-guide plan --out tfplan
infra-guide apply --plan-file tfplan --yes
Shell completion
# bash — add to ~/.bashrc
eval "$(infra-guide completion bash)"
# zsh — add to ~/.zshrc
eval "$(infra-guide completion zsh)"
# fish — add to ~/.config/fish/config.fish
infra-guide completion fish | source
Commands
| Command | Description | Risk |
|---|---|---|
status |
Fast workspace summary | Low |
doctor [--with-drift] |
Health diagnostics and recommendations | Low |
guide <command> |
Best practices for init, plan, apply, destroy | Low |
history [--favorites] [--clear] |
Recent commands and favorites | Low |
theme [--list] [--set NAME] |
Show or change the active theme | Low |
web [--port N] [--no-browser] |
Launch local browser command center | Low |
validate |
Pre-flight validation checks | Low |
drift |
Detect infrastructure drift | Low |
state [--list|--tree|--detail ADDR] |
Explore state resources | Low |
output [NAME] [--json|--raw] |
Show infrastructure output values | Low |
policy [--plan-file PATH] |
Check plan against built-in security policies | Low |
init [--upgrade] [--reconfigure] |
Initialize providers, modules, backend | Low |
plan [--out PATH] [--detailed-exitcode] |
Preview changes | Low |
apply [--plan-file PATH] [--yes] |
Apply changes with cost insight | Medium |
destroy [--yes] |
Delete managed infrastructure | High |
workspace [--list|--select|--create|--delete] |
Manage workspaces | Medium |
fmt [--check] [--diff] |
Format HCL files | Low |
cicd [--skip-init] [--skip-validation] |
Pipeline-friendly init/validate/plan flow | Medium |
completion <bash|zsh|fish> |
Output shell completion script | Low |
Usage examples
Doctor and status
infra-guide status # fast workspace panel
infra-guide doctor # full health check
infra-guide doctor --with-drift # health check + drift detection
Plan, apply, and destroy
infra-guide plan --out tfplan
infra-guide apply --plan-file tfplan --yes
infra-guide destroy --yes
# pass raw flags through to the IaC tool after --
infra-guide plan -- --target=module.network
infra-guide init -- --backend-config=env/dev.backend.hcl
Policy as code
# check the current directory against built-in security policies
infra-guide policy
# check a saved plan JSON
infra-guide plan --out tfplan.json
infra-guide policy --plan-file tfplan.json
Policies included out of the box:
| ID | Description | Severity |
|---|---|---|
no-public-s3 |
S3 buckets must not have a public ACL | High |
no-public-ingress |
Security groups must not allow 0.0.0.0/0 ingress | Critical |
require-tags |
Resources must have Environment and Owner tags |
Medium |
require-encryption |
AWS resources should have encryption enabled | High |
require-versioning |
S3 buckets should have versioning enabled | Medium |
no-default-vpc |
Resources should not reference the default VPC | Low |
Themes
infra-guide theme --list
infra-guide theme --set hacker # hacker | aurora | sunset | forest | mono | neon
Output values
infra-guide output # all outputs
infra-guide output bucket_name # single output
infra-guide output --json # raw JSON
State exploration
infra-guide state # overview
infra-guide state --list # flat list
infra-guide state --tree # grouped tree view
infra-guide state --detail aws_instance.web
Web command center
infra-guide web # opens http://localhost:8765
infra-guide web --port 9000
infra-guide web --no-browser # server only
Workspace management
infra-guide workspace --list
infra-guide workspace --create dev
infra-guide workspace --select prod
infra-guide workspace --delete staging
CI/CD mode
infra-guide cicd
infra-guide cicd --skip-init
infra-guide cicd --skip-validation
Suggested workflow
infra-guide doctor # 1. understand workspace health
infra-guide init # 2. initialize if needed
infra-guide plan --out tfplan # 3. preview and save
infra-guide policy # 4. check against security policies
infra-guide apply --plan-file tfplan --yes # 5. apply
Security and privacy
- No telemetry
- No credential handling inside infra-guide
- Network calls: only the background PyPI version check (cached 24 h, skipped on
--no-color) - Open source and auditable
Development
git clone https://github.com/iamtejas23/infra-guide.git
cd infra-guide
python3 -m venv venv && source venv/bin/activate
pip install -e ".[dev]"
pytest
black infra_guide/
flake8 infra_guide/ --max-line-length=100
Release to PyPI
Version lives in two files that must stay identical: pyproject.toml and infra_guide/__init__.py. After your feature work is committed and the tree is clean, bump with npm-style commands. Each command takes the current version, adds exactly one patch/minor/major step, refuses if that number already exists on PyPI or as a git tag, then commits, tags vX.Y.Z, and pushes. GitHub Actions publishes https://pypi.org/project/infra-guide/.
# see local vs git tag vs PyPI
npm run version
# preview the next number (no commit, no tag, no push)
npm run patch -- --dry-run
npm run minor -- --dry-run
npm run major -- --dry-run
# 0.9.0 -> 0.9.1 (bugfix)
npm run patch
# 0.9.1 -> 0.10.0 (feature)
npm run minor
# 0.10.0 -> 1.0.0 (breaking)
npm run major
Same commands without npm:
python3 scripts/release.py --show
python3 scripts/release.py patch --dry-run
python3 scripts/release.py patch
python3 scripts/release.py minor
python3 scripts/release.py major
Rules the script enforces:
- working tree must be clean (commit first)
pyproject.tomlversion must matchinfra_guide/__init__.py- next version must be current+1 for that part (no skipped numbers)
- next version must not already exist on PyPI or as
vX.Y.Z - if local is behind PyPI, it stops (sync first)
- if local is already ahead of PyPI, it stops (do not bump twice)
--no-push creates the commit and tag locally only. --offline skips the PyPI check.
Project structure
infra-guide/
├── infra_guide/
│ ├── cli.py # entry point and argument parser
│ ├── ui.py # Rich-based TUI
│ ├── runner.py # subprocess wrapper
│ ├── detector.py # tool detection (tofu / terraform)
│ ├── project_inspector.py # workspace metadata
│ ├── validators.py # pre-flight checks
│ ├── drift_detector.py # drift detection
│ ├── state_explorer.py # state file browser
│ ├── workspace_manager.py # workspace CRUD
│ ├── policy_checker.py # built-in policy engine
│ ├── cost_estimator.py # plan cost analysis
│ ├── cicd.py # CI/CD pipeline runner
│ ├── completion.py # shell completion scripts
│ ├── update_checker.py # background PyPI version check
│ ├── preferences.py # theme and history persistence
│ ├── web.py # browser command center
│ └── guides/ # command guide modules
├── scripts/
│ └── release.py # npm-style patch/minor/major PyPI release
├── package.json # npm run patch | minor | major
├── tests/
├── pyproject.toml
└── README.md
License
MIT — see LICENSE.
Metadata
Release files for infra-guide 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| infra_guide-0.9.1.tar.gz | 2.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| infra_guide-0.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.7 MB
Release files / infra_guide-0.9.1.tar.gz
| Download URL | infra_guide-0.9.1.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
433674632e9b9a33a585ba08e6fc4f9a7da5f02eac1613c8fbdf04d227d8faee
|
|
BLAKE2b-256 checksum How to use checksums |
c57f4fca0249bf8ce42ece6e51e8fc55d54371a56366473ebccbe71d97c227ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logRelease files / infra_guide-0.9.1-py3-none-any.whl
| Download URL | infra_guide-0.9.1-py3-none-any.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1729f93fea1a23e175ac5e27967359d700d8786568d05dc83bba75da70daaa4
|
|
BLAKE2b-256 checksum How to use checksums |
dfcadd60725379b1647cd193bf7d9afa45b7b962a31e72c2f2fe24dcbb076432
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency log