Convert architecture diagrams into IaC modules
Project description
diagram-to-iac
"One container, many mindsโzero manual toil."
An automated DevOps-in-a-Box system that intelligently handles complete Repo-to-Deployment (R2D) workflows. The project combines AI-powered infrastructure analysis with GitHub automation for self-healing deployments.
๐ DevOps-in-a-Box: R2D Action
The R2D (Repo-to-Deployment) Action is a self-healing, Terraform-first DevOps automation solution that lives inside a single GitHub Action. When you supply any repository URL, our SupervisorAgent marshals specialized agents to handle the complete deployment workflow.
๐ฏ 2-Minute Quick Start
Step 1: Add the unified workflow to your repository:
# .github/workflows/r2d-unified.yml
name: R2D - DevOps in a Box
on:
issues:
types: [opened, edited]
pull_request:
types: [closed]
workflow_dispatch:
inputs:
repo_url:
description: 'Repository URL to deploy'
required: false
type: string
jobs:
r2d-deploy:
uses: amartyamandal/diagram-to-iac/.github/workflows/r2d-unified.yml@main
secrets: inherit
with:
repo_url: ${{ inputs.repo_url || github.server_url }}/${{ github.repository }}
Step 2: Configure your secrets (see complete guide)
Step 3: Trigger deployment via issue, PR merge, or manual run
๐ Complete Setup Guide - Everything you need in one place!
Key Features
- ๐ค Self-Healing: Automatically creates GitHub Issues for errors and suggests fixes
- ๐ Security-First: Non-root container execution with workspace isolation
- ๐ Multi-Cloud: Supports Terraform, PowerShell, Bash, and Ansible deployments
- ๐ Observable: Rich logging, step summaries, and artifact collection
- ๐ Resumable: Thread-based conversation tracking for workflow continuation
- ๐งช Testable: Comprehensive dry-run mode for safe testing
The Cast: Specialized Agents
| Agent | Capability | Never Does |
|---|---|---|
| SupervisorAgent | Orchestrates workflow, manages checkpoints | Edit code directly |
| GitAgent | Clone, branch, PR creation, assign @github-copilot | Guess network credentials |
| ShellAgent | Safe command execution, stack detection | Execute non-allowlisted binaries |
| TerraformAgent | Init/plan/apply, error classification | Apply with critical security issues |
| PolicyAgent | tfsec + OPA security gates | Ignore critical findings |
๐ฆ Installation
Create a virtual environment with Python 3.11+ and install the project in editable mode. Development dependencies (linting, testing, etc.) are provided through the dev extra:
pip install -e .[dev]
๐ฅ๏ธ Running the CLI
The project exposes several entry points via pyproject.toml:
Main R2D CLI
# Run complete R2D workflow
diagram-to-iac https://github.com/user/repo
r2d-agent https://github.com/user/repo --dry-run
# Get help
diagram-to-iac --help
Individual Agent CLIs
# SupervisorAgent (orchestration)
supervisor-agent --repo-url https://github.com/user/repo
# GitAgent (repository operations)
git-agent --repo-url https://github.com/user/repo
# TerraformAgent (infrastructure deployment)
terraform-agent --query "terraform plan"
Interactive Mode
Running without arguments enters interactive mode:
$ supervisor-agent --dry-run
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค DevOps-in-a-Box: SupervisorAgent โ
โ "One container, many mindsโzero manual toil." โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Repository URL: https://github.com/octocat/Hello-World.git
๐ R2D SupervisorAgent - Workflow Orchestration
๐
Default branch name: r2d-<timestamp>
๐ Press Enter to use default, or type a custom branch name:
The agent will continue with the complete workflow (clone โ detect โ deploy โ issue creation). The --dry-run flag simulates actions without making changes.
Running Tests
All tests use pytest and are located under the tests directory. After installing the development dependencies, run:
pytest
๐ Logs and Observability
DevOps-in-a-Box provides comprehensive observability for all R2D workflows:
Structured Logging
Each run creates a JSONL log file under the logs/ directory (e.g. logs/run-<timestamp>.jsonl).
Every significant event is logged as structured JSON for easy parsing and analysis:
# Follow live logs
tail -f logs/run-*.jsonl
# Parse with jq for specific events
cat logs/run-*.jsonl | jq '. | select(.event_type == "terraform_apply")'
Step Summary Dashboard
After each workflow, a Markdown dashboard is generated at step-summary.md with:
- ๐ Terraform resource changes and cost estimates
- ๐ Security findings from tfsec/OPA scans
- ๐๏ธ Infrastructure modules and dependencies
- โก Performance metrics and execution times
GitHub Integration
- Issues: Automatically created for errors with detailed context
- Pull Requests: Auto-drafted fixes assigned to @github-copilot
- Workflow Summaries: Rich GitHub Actions step summaries
- Artifacts: Logs, plans, and reports uploaded for download
CI/CD Artifacts
In GitHub Actions, the following artifacts are automatically collected:
logs/- Structured JSONL logs*.tfplan- Terraform plan filesstep-summary.md- Workflow dashboardr2d-artifacts/- Complete workflow artifacts
๐ง GitHub Actions Usage
The R2D system now uses a unified workflow that handles all deployment scenarios automatically. This replaces the previous multiple workflow files with a single, intelligent solution.
โก Simple Setup (Recommended)
Add this single workflow file to get all R2D capabilities:
# .github/workflows/r2d-unified.yml
name: R2D - DevOps in a Box
on:
issues:
types: [opened, edited]
pull_request:
types: [closed]
workflow_dispatch:
inputs:
repo_url:
description: 'Repository URL to deploy'
required: false
type: string
jobs:
r2d-deploy:
uses: amartyamandal/diagram-to-iac/.github/workflows/r2d-unified.yml@main
secrets: inherit
with:
repo_url: ${{ inputs.repo_url || github.server_url }}/${{ github.repository }}
๐ฎ Multiple Ways to Deploy
- ๐ Issue-based: Create an issue with "deploy" in title/body
- ๐ PR merge: Automatic deployment when PRs are merged
- ๐ฏ Manual: Use workflow_dispatch with optional custom repo URL
- ๐ External repos: Deploy any accessible repository
๐ Required Secrets
Configure these in your repository settings โ Secrets and variables โ Actions:
| Secret | Description | Required |
|---|---|---|
GITHUB_TOKEN |
GitHub API access (auto-provided) | โ Yes |
TF_CLOUD_TOKEN |
Terraform Cloud workspace token | โ Yes |
OPENAI_API_KEY |
OpenAI API key for AI features | โ Optional |
ANTHROPIC_API_KEY |
Claude API key for AI features | โ Optional |
DOCKERHUB_USERNAME |
DockerHub username for private containers | โ Optional |
DOCKERHUB_TOKEN |
DockerHub access token for private containers | โ Optional |
๐ Complete Setup Guide includes examples, troubleshooting, and advanced configurations.
Note: The system automatically maps
TF_CLOUD_TOKENto the internalTFE_TOKENenvironment variable. DockerHub: Only needed if using private container registries.
๐ Observability & Monitoring
After each workflow run, comprehensive artifacts are generated:
- ๐ Step Summary Dashboard:
step-summary.mdwith Terraform changes, security findings, and metrics - ๐ Structured Logs: JSONL format in
logs/directory for analysis - ๐ GitHub Integration: Automatic issue creation and PR suggestions
- ๐ฆ Artifacts: Plans, reports, and logs uploaded as GitHub Actions artifacts
๐งช Development & Testing
For local development and testing:
# Install development dependencies
pip install -e .[dev]
# Run the CLI locally
diagram-to-iac https://github.com/user/repo --dry-run
# Run tests
pytest
๐ Documentation
๐ฏ THE ONLY GUIDE YOU NEED: Definitive Integration Guide
All other documentation is for reference only. Start with the guide above.
Reference Documentation
- Working Examples - Copy-paste examples that work immediately
- R2D User Guide - Complete setup and usage guide
- Migration Guide - Migrate from old workflows to unified approach
- Container Action - Technical details of the container action
- Agent Architecture - How the AI agents work together
- Simplification Summary - What changed in the unified approach
๐ค Contributing
This project follows strict coding standards and security practices. See the development guidelines in the repository for contribution instructions.
"One container, many mindsโzero manual toil." ๐ค
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diagram_to_iac-1.12.0.tar.gz.
File metadata
- Download URL: diagram_to_iac-1.12.0.tar.gz
- Upload date:
- Size: 148.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ee48a031d57a25a69705c0162bc7b8b6724adbb1852632775a42b9e0d067cb7
|
|
| MD5 |
a122dc2c019dee9f18ce72180fc242d7
|
|
| BLAKE2b-256 |
919f2000efb5f2400dd70a2a3ce1e461c58487f31902239ba6de5f38633b38f2
|
File details
Details for the file diagram_to_iac-1.12.0-py3-none-any.whl.
File metadata
- Download URL: diagram_to_iac-1.12.0-py3-none-any.whl
- Upload date:
- Size: 170.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8b28c4670d7461f8a17f39657c41d1adf8c3b7604a86a5c5598a508a480bb79
|
|
| MD5 |
3b16617454b9a4c10c545f00d7fbcf2f
|
|
| BLAKE2b-256 |
b24f698fd92aec0ffefb34098e7e80976b6808a5a2b29472c9e4655dda65e97a
|