Modular cloud provider and service implementations for the Infrar Infrastructure Intelligence Platform
Plugin system providing three-level orchestration architecture for deploying applications to cloud providers. Each provider, category, and service has its own orchestrator that generates Terraform configurations dynamically.
-
Service Level - Individual cloud services (e.g., cloud-run, cloud-storage)
- Generates service-specific Terraform resources
- Handles service-level configuration and builds
-
Category Level - Service categories (e.g., compute, storage)
- Combines services within a category
- Coordinates service orchestrators
-
Provider Level - Cloud providers (e.g., GCP)
- Assembles complete provider configuration
- Coordinates category orchestrators
Compute Services:
- Cloud Run - Deploy containerized Python applications with automatic scaling
- Automatic container building from source code
- Integrated Infrar SDK for storage operations
- HTTP endpoint with health checks
- Auto-scaling 0-10 instances
Storage Services:
- Cloud Storage - Object storage with global availability
- Bucket creation and management
- Versioning and lifecycle rules
- CORS configuration support
- IAM integration
providers/
βββ gcp/
βββ orchestrator/ # Provider-level orchestration
β βββ main.go
β βββ orchestrate # Binary
βββ terraform-config/ # Provider Terraform templates
β βββ provider-block.tf.tmpl
β βββ variables.tf.tmpl
β βββ tfvars.tmpl
βββ services/
βββ compute/
β βββ orchestrator/ # Category orchestrator
β β βββ main.go
β β βββ orchestrate
β βββ cloud-run/
β βββ orchestrator/ # Service orchestrator
β β βββ main.go
β β βββ orchestrate
β βββ terraform/ # Service Terraform templates
β β βββ main.tf
β β βββ variables.tf
β β βββ outputs.tf
β β βββ tfvars.tmpl
β βββ service.yaml # Service metadata
β βββ build.sh # Container build script
βββ storage/
βββ orchestrator/ # Category orchestrator
β βββ main.go
β βββ orchestrate
βββ cloud-storage/
βββ orchestrator/ # Service orchestrator
β βββ main.go
β βββ orchestrate
βββ terraform/ # Service Terraform templates
β βββ main.tf
β βββ variables.tf
β βββ outputs.tf
β βββ tfvars.tmpl
βββ service.yaml # Service metadata
The platform analyzes user code to detect required capabilities:
import infrar.storage
infrar.storage.upload(bucket='my-bucket', source='file.txt')Detected capabilities: storage, compute (for execution)
Based on capabilities, recommend cloud services:
- Storage capability β Cloud Storage
- Compute capability β Cloud Run
Provider Orchestrator (gcp/orchestrator)
- Receives: capabilities, context, credentials, custom variables
- Calls: category orchestrators for compute and storage
- Generates: provider.tf, combines all service resources
Category Orchestrator (compute/orchestrator)
- Receives: compute capabilities
- Calls: cloud-run service orchestrator
- Generates: combined category resources
Service Orchestrator (cloud-run/orchestrator)
- Receives: service parameters
- Generates: main.tf, variables.tf, terraform.tfvars for Cloud Run
build.sh Script:
- Receives user's Python code via stdin
- Creates Infrar SDK (
infrar/storage.py) - Wraps code in Flask application
- Builds Docker container
- Authenticates to Google Container Registry
- Pushes image to
gcr.io/project-id/app-name:latest - Returns image URL
Platform runs terraform:
terraform init
terraform plan
terraform applyResources created:
- Cloud Storage bucket (custom named)
- Cloud Run service running user's container
- IAM bindings for access
name: cloud-run
display_name: Cloud Run
category: compute
provider: gcp
capabilities:
- compute
description: Deploy containerized applications with automatic scalingInput (JSON via stdin):
{
"command": "generate",
"capabilities": ["compute"],
"context": {
"project_name": "my-app",
"environment": "production",
"region": "us-central1"
},
"credentials": {
"gcp_service_account_json": "..."
},
"parameters": {
"service_name": "my-service",
"container_image": "gcr.io/project/image:latest"
}
}Output (JSON via stdout):
{
"success": true,
"files": {
"main.tf": "...",
"variables.tf": "...",
"terraform.tfvars": "..."
},
"metadata": {
"services_included": ["cloud-run"],
"warnings": [],
"required_apis": ["run.googleapis.com"]
}
}Input (JSON via stdin):
{
"project_id": "my-gcp-project",
"code": "import infrar.storage\n...",
"image_name": "my-app",
"credentials": "{\"project_id\": \"...\"}"
}Output (JSON via stdout):
{
"success": true,
"image": "gcr.io/my-gcp-project/my-app:latest",
"message": "Container built and pushed successfully"
}Available in all .tmpl files:
tfstring- Quote value for Terraform:{{ .name | tfstring }}β"value"default- Provide default:{{ .var | default "fallback" }}sanitize- Lowercase and clean:{{ .ProjectName | sanitize }}β"my-project"
# Provider orchestrator
cd providers/gcp/orchestrator
go build -o orchestrate main.go
# Category orchestrators
cd providers/gcp/services/compute/orchestrator
go build -o orchestrate main.go
cd providers/gcp/services/storage/orchestrator
go build -o orchestrate main.go
# Service orchestrators
cd providers/gcp/services/compute/cloud-run/orchestrator
go build -o orchestrate main.go
cd providers/gcp/services/storage/cloud-storage/orchestrator
go build -o orchestrate main.goecho '{
"command": "generate",
"capabilities": ["compute"],
"context": {
"project_name": "test",
"environment": "dev",
"region": "us-central1"
},
"credentials": {},
"parameters": {}
}' | ./providers/gcp/services/compute/cloud-run/orchestrator/orchestrate | jq .echo '{
"project_id": "test-project",
"code": "import infrar.storage\nprint(\"hello\")",
"image_name": "test-app",
"credentials": "{}"
}' | ./providers/gcp/services/compute/cloud-run/build.shThe build script automatically includes the Infrar Python SDK:
infrar/storage.py:
from google.cloud import storage
def upload(bucket, source, destination=None):
"""Upload file to Cloud Storage"""
if destination is None:
destination = os.path.basename(source)
client = storage.Client()
bucket_obj = client.bucket(bucket)
blob = bucket_obj.blob(destination)
blob.upload_from_filename(source)
return f"gs://{bucket}/{destination}"- β GCP provider
- β Cloud Storage
- β Cloud Run
- β Three-level orchestration
- β Automatic containerization
- β Custom variable support
- AWS provider (Lambda, S3)
- Azure provider (Container Apps, Blob Storage)
- Additional GCP services (Cloud Functions, Cloud SQL)
- Secret management integration
- Database plugins
- Messaging plugins
- Multi-cloud deployments
- Cost optimization
GNU General Public License v3.0
- infrar-platform - Platform backend
- infrar-engine - Transformation engine
- infrar-sdk-python - Python SDK
- infrar-docs - Documentation
Part of the Infrar project - Infrastructure Intelligence for the multi-cloud era