TerraGuard is a next-generation DevOps platform that brings AI-assisted reasoning, Structured parsing and normalization of IaC, cost intelligence and Graph-based dependency into the Terraform workflow โ enabling engineers to understand, visualize, and evaluate infrastructure before it is deployed.
As Infrastructure-as-Code scales, Terraform configurations become increasingly complex, abstract, and difficult to interpret. While existing tools focus on execution and state changes, they lack the ability to explain infrastructure as a system โ how components interact, what they represent, and what they are ultimately built for.
๐ Built for terminal-first DevOps workflows, TerraGuard delivers fast, in-context analysis through a powerful TUI โ eliminating the need for external dashboards and keeping engineers fully in the CLI.
TerraGuard introduces an intelligent analysis layer on top of Terraform by combining:
- ๐ง AI-powered infrastructure interpretation
- ๐งฉ Structured parsing and normalization of IaC
- ๐ณ Graph-based dependency modeling
- ๐ฐ Cloud pricing intelligence via AWS APIs
๐ transforming raw Terraform into clear, explainable, and actionable infrastructure insights
๐ Even without AI, TerraGuard provides structured analysis, dependency visualization, and cost evaluation, ensuring meaningful insights are always available.
- ๐งฉ Parse Terraform into structured resource models
- ๐ณ Build dependency graphs to represent relationships
- ๐ฐ Evaluate cost using AWS Pricing APIs
- ๐ง Integrate AI to explain infrastructure clearly
- ๐ฅ๏ธ Provide an interactive TUI for exploration
๐ Bridges the gap between writing infrastructure and understanding it
TerraGuard integrates an AI reasoning layer that interprets infrastructure and converts it into clear, concise, and meaningful explanations.
- Translates complex Terraform into human-understandable insights
- Explains both structure and real-world purpose
- Enhances collaboration between developers, DevOps, and teams
๐ AI acts as an interpretation layer over structured infrastructure data, not a replacement for it
TerraGuard transforms Terraform into a structured infrastructure model:
- Extracts resources from
.tfconfigurations - Resolves variables and interpolations
- Interprets dynamic constructs (
count,for_each) - Normalizes infrastructure into a graph-ready representation
๐ Enables deeper analysis beyond raw IaC
Models infrastructure as a directed dependency graph:
- Captures relationships between resources
- Represents connectivity and execution flow
- Enables architectural reasoning before deployment
๐ Allows you to visualize infrastructure before it exists
TerraGuard integrates with the AWS Pricing API (boto3) to perform dynamic cost evaluation:
EC2 โ $0.0104/hr
S3 โ $0.0023/hr
RDS โ Based on instance configuration
- Maps Terraform resources to pricing dimensions
- Resolves region-aware pricing dynamically
- Produces resource-level cost breakdowns
๐ Enables cost-aware infrastructure planning
Terraform focuses on execution. TerraGuard focuses on understanding.
| Feature | Terraform Plan | TerraGuard |
|---|---|---|
| Shows resource changes | โ | โ |
| Explains architecture | โ | โ |
| Human-readable understanding | โ | โ |
| Cost estimation | โ | โ |
| Dependency visualization | โ | โ |
| Pre-deployment insight | โ Strong |
๐ Terraform answers โwhat will happenโ ๐ TerraGuard explains โwhat this infrastructure actually is and why it existsโ
terraguard init| Key | Action |
|---|---|
| q | Quit |
| c | Copy selected resource |
| C | Copy all resources + cost |
| / | Search |
| e | Explain selected resource |
| E | Explain full infrastructure |
- Unified view of structure, cost, and AI insights
- Designed for efficient DevOps workflows
terraguard/
โ
โโโ cli.py
โโโ parser.py
โโโ variable_resolver.py
โโโ cost_engine.py
โโโ pricing_engine.py
โโโ diagram.py
โโโ formatter.py
โโโ tui/
โโโ ai_explainer.py
โโโ optimizer/
git clone https://github.com/Anantch2005/terraguard-ai.git
cd terraguard-aipython3 -m venv venv
source venv/bin/activate # Linux / Mac
# venv\Scripts\activate # Windowspip install -r requirements.txtpip install .๐ This installs the terraguard command globally in your environment
Create a .env file in the root directory:
GROQ_API_KEY=your_api_key_hereaws configureexport AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-east-1๐ Without AWS credentials, cost estimation features will be limited
terraguard initcd terraform_examples/basic
terraguard initFor the best visual experience, use a Nerd Font in your terminal to properly render icons in the TUI.
- Python
- Typer
- Rich
- Textual
- python-hcl2
- AWS Pricing API (boto3)
- Groq API
- โ๏ธ Multi-cloud support (AWS, Azure, GCP) for unified infrastructure analysis
- ๐ CI/CD integration for automated pre-deployment validation
- ๐ Terraform plan analysis for deeper change visibility
- ๐จ Security & policy validation to detect misconfigurations early
- ๐ฐ Budget enforcement with intelligent cost thresholds
- ๐ค Autonomous infrastructure optimization using AI-driven recommendations
๐ Vision: Evolve TerraGuard into a fully autonomous DevOps AI agent capable of analyzing, securing, and optimizing infrastructure before deployment.
- Understand infrastructure before deployment
- Simplify complex Terraform configurations
- Validate architecture design
- Perform cost-aware planning
- Learn and visualize cloud systems
Built by Anant Chaudhary
DevOps Engineer (aspiring) | Building intelligent cloud systems ๐
๐ From writing infrastructure โ to understanding infrastructure before it exists
TerraGuard represents the future of DevOps where infrastructure is interpreted, visualized, and intelligently analyzed before deployment.





