Metadata-Version: 2.4
Name: infragen
Version: 0.1.0
Summary: Multi-agent CLI that generates Terraform and deploys full-stack apps to AWS/GCP free tier
Project-URL: Repository, https://github.com/adityapanyala/infragen
Author: Aditya Panyala
License: MIT
Keywords: agents,aws,cli,free-tier,gcp,iac,llm,terraform
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27.0
Requires-Dist: langchain-core>=0.3.0
Requires-Dist: langchain-groq>=0.2.0
Requires-Dist: langgraph>=0.2.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: python-hcl2>=4.3.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.12.0
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# InfraGen

Multi-agent CLI that takes a plain-English description of your app and deploys it to the **AWS or GCP free tier** — generates Terraform, provisions infrastructure, and pushes your code, with a review-and-confirm gate before anything runs.

```
$ infragen deploy
detected: react frontend at ./frontend; fastapi backend at ./backend
tf_write: attempt 1 generated 219 lines of HCL
guardrail: PASS, 0 warning(s)
validate: PASS
+--------------------------- review before deploy ---------------------------+
| terraform plan: 10 to add, 0 to change, 0 to destroy                       |
|   aws_instance.backend (created)                                           |
|   aws_s3_bucket.frontend (created)  ...                                    |
| free tier: all resources within free tier limits                           |
| deploy steps:                                                              |
|   1. build frontend (react)                                                |
|   2. upload frontend to s3://...                                           |
|   3. copy backend code to ubuntu@...                                       |
|   4. install dependencies and start fastapi on port 8000                   |
| estimated monthly cost: $0.00 (free tier)                                  |
+----------------------------------------------------------------------------+
Deploy this? [y/N]:
```

## Why

Free-tier users get surprise bills from two things: resources that were never free (NAT gateways, oversized instances) and forgotten resources left running. InfraGen guards both ends: a **deterministic free-tier auditor** checks every generated resource against hardcoded limit tables (an LLM can miss a paid instance type; a dict lookup can't), and `infragen destroy` tears everything down from tracked state.

## Install

```bash
pip install -e ".[dev]"        # from a clone (PyPI release planned)
cp .env.example .env           # add YOUR OWN free Groq API key (console.groq.com/keys)
infragen doctor                # verify terraform + aws/gcloud are ready
```

**Bring your own accounts** — infragen ships no credentials. You need:

- Python 3.11+ and [Terraform](https://developer.hashicorp.com/terraform/install)
- your own **Groq API key** (free, no credit card) in a `.env` file in your project, or globally in `~/.infragen.env`
- your own **AWS** account with the CLI authenticated (`aws configure`), or **GCP** with `gcloud auth login` — deploys go to *your* cloud account, on its free tier

The CLI checks all of this up front and prints setup instructions for anything missing.

## Usage

```bash
infragen                        # REPL: describe infra, get audited Terraform
infragen deploy                 # scan project -> generate -> review -> deploy
infragen deploy --dry-run       # everything except apply (CI-friendly)
infragen destroy                # tear down everything (with confirmation)
infragen explain ./main.tf      # plain-English explanation of any Terraform
infragen translate ./ --to gcp  # convert AWS Terraform to GCP (or vice versa)
infragen validate ./            # terraform validate + free-tier audit + tflint
infragen doctor                 # prerequisite checks
```

Supported app patterns (any combination): static frontends (React/Vue/Next/plain) on S3 or Cloud Storage, Python backends (FastAPI/Flask/Django) on EC2 or Compute Engine. All artifacts and state live in `.infragen/` inside your project, so redeploys update the same stack.

## How it works

A LangGraph state machine (running on Groq's free LLM tier) drives generation: a **TF writer** produces HCL, a **deterministic guardrail** blocks anything outside free-tier limits (feeding precise substitutions back for a rewrite), and a **validator** loops `terraform validate` errors back until clean — max 3 attempts. Deployment steps are built deterministically from the scanned app spec plus real terraform outputs, and the review panel is backed by actual `terraform plan` output, never an LLM's summary of intent.

## Development

```bash
python -m pytest tests/ -q     # unit tests (no API key needed)
```
