Skip to content

About

TerraGuard is a DevOps platform that analyzes Terraform before deployment, generating human-readable insights, AI-powered infrastructure explanations, dependency graphs, and cost estimations. It enables engineers to understand, validate, and optimize cloud architecture before it goes live.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TerraGuard ๐Ÿš€

AI-Augmented Terraform Intelligence & Pre-Deployment Analysis Platform

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.


โšก Core Capabilities

  • ๐Ÿงฉ 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


๐Ÿง  AI-Assisted Infrastructure Understanding

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


๐Ÿงฉ Infrastructure Parsing & Modeling

TerraGuard transforms Terraform into a structured infrastructure model:

  • Extracts resources from .tf configurations
  • Resolves variables and interpolations
  • Interprets dynamic constructs (count, for_each)
  • Normalizes infrastructure into a graph-ready representation

๐Ÿ‘‰ Enables deeper analysis beyond raw IaC


๐ŸŒณ Dependency Graph & Visualization

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


๐Ÿ’ฐ Cost Evaluation Engine

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 Plan vs TerraGuard

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 โš ๏ธ Limited โœ… Strong

๐Ÿ‘‰ Terraform answers โ€œwhat will happenโ€ ๐Ÿ‘‰ TerraGuard explains โ€œwhat this infrastructure actually is and why it existsโ€


๐Ÿ–ฅ๏ธ Interactive Terminal UI (TUI)

terraguard init

๐ŸŽฎ Controls

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

๐Ÿงช Infrastructure Analysis Examples

๐Ÿ”น Basic


๐Ÿ”น Medium


๐Ÿ”น Advanced


โš™๏ธ System Architecture

terraguard/
โ”‚
โ”œโ”€โ”€ cli.py
โ”œโ”€โ”€ parser.py
โ”œโ”€โ”€ variable_resolver.py
โ”œโ”€โ”€ cost_engine.py
โ”œโ”€โ”€ pricing_engine.py
โ”œโ”€โ”€ diagram.py
โ”œโ”€โ”€ formatter.py
โ”œโ”€โ”€ tui/
โ”œโ”€โ”€ ai_explainer.py
โ””โ”€โ”€ optimizer/

โš™๏ธ Installation & Setup

1๏ธโƒฃ Clone Repository

git clone https://github.com/Anantch2005/terraguard-ai.git
cd terraguard-ai

2๏ธโƒฃ Create Virtual Environment

python3 -m venv venv
source venv/bin/activate   # Linux / Mac
# venv\Scripts\activate    # Windows

3๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

4๏ธโƒฃ Install TerraGuard (CLI Setup)

pip install .

๐Ÿ‘‰ This installs the terraguard command globally in your environment


5๏ธโƒฃ Configure Environment Variables

Create a .env file in the root directory:

GROQ_API_KEY=your_api_key_here

6๏ธโƒฃ Configure AWS Credentials (Required for Cost Analysis)

๐Ÿ”น Option 1 โ€” AWS CLI (Recommended)

aws configure

๐Ÿ”น Option 2 โ€” Environment Variables

export 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


7๏ธโƒฃ Run TerraGuard

terraguard init

๐Ÿงช Example Usage

cd terraform_examples/basic
terraguard init

๐Ÿ’ก Tip

For the best visual experience, use a Nerd Font in your terminal to properly render icons in the TUI.


๐Ÿ› ๏ธ Tech Stack

  • Python
  • Typer
  • Rich
  • Textual
  • python-hcl2
  • AWS Pricing API (boto3)
  • Groq API

๐Ÿ”ฎ Future Roadmap

  • โ˜๏ธ 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.

๐ŸŽฏ Use Cases

  • Understand infrastructure before deployment
  • Simplify complex Terraform configurations
  • Validate architecture design
  • Perform cost-aware planning
  • Learn and visualize cloud systems

๐Ÿ‘จโ€๐Ÿ’ป Author

Built by Anant Chaudhary

DevOps Engineer (aspiring) | Building intelligent cloud systems ๐Ÿš€


โญ Vision

๐Ÿ‘‰ 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.

TerraGuard-ai

About

TerraGuard is a DevOps platform that analyzes Terraform before deployment, generating human-readable insights, AI-powered infrastructure explanations, dependency graphs, and cost estimations. It enables engineers to understand, validate, and optimize cloud architecture before it goes live.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages