How codecrafter001/terraform_agent works
TerraAgent turns a user’s AWS migration or infrastructure request into discovered inventory, dependency and adoption plans, generated Terraform/OpenTofu, validation and security results, and downloadable artifacts. The frontend initiates scans and presents progress, approvals, and results; the API and job pipeline invoke the stateful agent graph, which can pause for human approval and resume. README-documented agent stages are included, but several agent implementations were not sampled, so those stage links cite the README rather than implying source inspection.
Main entry points: graph.py Agent graph · pipeline.py Pipeline coordinator · scan.py Scan API · api.ts Frontend API client
Components 24
User experience
- TerraAgent dashboard
frontend/app/page.tsx - Results and approval UI
frontend/components/ScanProgress.tsx - Frontend API client
frontend/lib/api.ts
API and jobs
- Scan API
backend/routers/scan.py - Background job runner
backend/services/celery_app.py - Pipeline coordinator
backend/services/pipeline.py
Migration intelligence
- Agent graph
backend/agents/graph.py - Request intent
backend/agents/intent_router.py - AWS discovery
backend/agents/cloud_discovery.py - Dependency topology
backend/agents/graph_agent.py - Resource classification
backend/tools/resource_classifier.py - Adoption planning
backend/tools/adoption_planner.py - IaC composition
backend/agents/terraform_composer.py
Verification and delivery
- Sandbox validation
backend/agents/validation_agent.py - Terraform and OpenTofu
backend/tools/iac_engine.py - Policy and security
backend/agents/policy_agent.py - Validation repair
backend/agents/validation_repair.py - Reports and artifacts
backend/agents/documentation_agent.py - GitHub adoption PR
backend/services/github_client.py
Persistence
- Live job state and logs
backend/services/redis_client.py - Job audit records
backend/services/database.py
Other components
- Engineer
- Human reviewer
- AWS estate
Connections 25
- Engineer → TerraAgent dashboard: submits request
README.md - TerraAgent dashboard → Frontend API client: uses API
- Frontend API client → Scan API: requests scan
- Scan API → Background job runner: queues job
backend/routers/scan.py - Background job runner → Pipeline coordinator: runs pipeline
backend/services/celery_app.py - Pipeline coordinator → Agent graph: runs graph
backend/services/pipeline.py - Agent graph → Request intent: routes intent
backend/agents/graph.py - Agent graph → AWS discovery: dispatches discovery
README.md - AWS discovery → AWS estate: reads inventory
README.md - Agent graph → Dependency topology: dispatches graphing
README.md - Agent graph → Resource classification: dispatches classification
README.md - Agent graph → Adoption planning: plans adoption
README.md - Agent graph → IaC composition: dispatches composition
README.md - Agent graph → Sandbox validation: dispatches validation
README.md - Sandbox validation → Terraform and OpenTofu: executes checks
backend/tools/iac_engine.py - Agent graph → Policy and security: dispatches policy checks
README.md - Agent graph → Validation repair: retries repair
README.md - Agent graph → Reports and artifacts: produces artifacts
README.md - Pipeline coordinator → Live job state and logs: publishes job state
backend/services/pipeline.py - Pipeline coordinator → Job audit records: records job
backend/services/pipeline.py - Pipeline coordinator → Human reviewer: pauses for decision
backend/services/pipeline.py - Human reviewer → Scan API: submits decision
- Scan API → Live job state and logs: reads status
backend/routers/scan.py - Results and approval UI → Frontend API client: loads results
- Reports and artifacts → GitHub adoption PR: enables PR delivery