# Terraform MCP Server

## Project Overview
Multi-cloud MCP server for discovering and generating Terraform code from module catalogs across AWS, Azure, and GCP.

## Architecture
- `src/tf_mcp/server.py` — FastMCP entry point with tools and resources
- `src/tf_mcp/registry.py` — Multi-cloud module registry, auto-discovers sibling repos
- `src/tf_mcp/parser.py` — Cloud-agnostic HCL parser for variables, outputs, costs
- `src/tf_mcp/models.py` — Pydantic models (ModuleInfo, VariableInfo, etc.)
- `src/tf_mcp/codegen.py` — Multi-cloud Terraform code generation
- `src/tf_mcp/dependencies.py` — Unified dependency/wiring lookup across clouds
- `src/tf_mcp/clouds/{aws,azure,gcp}.py` — Per-cloud static metadata (layers, wiring, descriptions)

## Adding a new cloud's module metadata
1. Add module layers, descriptions, dependencies, wiring to `src/tf_mcp/clouds/<cloud>.py`
2. The registry will auto-discover modules from the sibling `<cloud>-tf/modules/` directory
3. For clouds without metadata, the registry discovers all subdirs with a `main.tf`

## Key patterns
- `python-hcl2` strips comments — cost blocks parsed via regex on raw text
- hcl2 represents types as nested lists: `['list', 'string']` -> `list(string)`
- All tools accept a `cloud` parameter; `list_modules` accepts optional cloud filter
- Provider config (source, version, provider block) lives in per-cloud metadata
