|
| 1 | +# Bifrost Terraform Modules |
| 2 | + |
| 3 | +Deploy Bifrost on AWS, GCP, Azure, or any Kubernetes cluster using a single Terraform module. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +```hcl |
| 8 | +module "bifrost" { |
| 9 | + source = "./modules/bifrost" |
| 10 | + cloud_provider = "aws" # "aws" | "gcp" | "azure" | "kubernetes" |
| 11 | + service = "ecs" # AWS: "ecs" | "eks", GCP: "gke" | "cloud-run", Azure: "aks" | "aci", K8s: "deployment" |
| 12 | + region = "us-east-1" |
| 13 | + image_tag = "v1.4.6" |
| 14 | +
|
| 15 | + # Option A: Provide a config.json file |
| 16 | + config_json_file = "./config.json" |
| 17 | +
|
| 18 | + # Option B: Build config from Terraform variables (overrides matching keys from file) |
| 19 | + providers_config = { |
| 20 | + openai = { keys = [{ value = var.openai_key, weight = 1 }] } |
| 21 | + } |
| 22 | + config_store = { |
| 23 | + enabled = true |
| 24 | + type = "postgres" |
| 25 | + config = { host = var.db_host, port = "5432", user = "bifrost", password = var.db_password, db_name = "bifrost" } |
| 26 | + } |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +## Supported Deployments |
| 31 | + |
| 32 | +| Cloud | Service | Description | |
| 33 | +|-------|---------|-------------| |
| 34 | +| AWS | `ecs` | ECS Fargate with ALB, Secrets Manager, auto-scaling | |
| 35 | +| AWS | `eks` | EKS with K8s Deployment, PVC for SQLite, HPA | |
| 36 | +| GCP | `gke` | GKE with K8s Deployment, persistent disk, HPA | |
| 37 | +| GCP | `cloud-run` | Cloud Run v2 with Secret Manager, auto-scaling | |
| 38 | +| Azure | `aks` | AKS with K8s Deployment, managed disk, HPA | |
| 39 | +| Azure | `aci` | Azure Container Instances (single instance, dev/test) | |
| 40 | +| Kubernetes | `deployment` | Any K8s cluster with Deployment, PVC, HPA, Ingress | |
| 41 | + |
| 42 | +## Configuration |
| 43 | + |
| 44 | +Bifrost config can come from two sources simultaneously. Terraform variables override matching keys from the base file. |
| 45 | + |
| 46 | +1. **File-based**: Set `config_json_file` to a path or `config_json` to a raw JSON string. |
| 47 | +2. **Variable-based**: Set individual variables (`config_store`, `logs_store`, `providers_config`, `auth_config`, etc.) corresponding to top-level keys in [config.schema.json](../transports/config.schema.json). |
| 48 | + |
| 49 | +All 16 top-level config properties from the schema are supported as variables: |
| 50 | +`encryption_key`, `auth_config`, `client`, `framework`, `providers_config`, `governance`, `mcp`, `vector_store`, `config_store`, `logs_store`, `cluster_config`, `saml_config`, `load_balancer_config`, `guardrails_config`, `plugins`, `audit_logs`. |
| 51 | + |
| 52 | +## Directory Structure |
| 53 | + |
| 54 | +```text |
| 55 | +terraform/ |
| 56 | + modules/bifrost/ # Top-level module (the only thing you call) |
| 57 | + aws/ # AWS platform (VPC, SG, IAM, Secrets Manager) |
| 58 | + services/ecs/ # ECS Fargate |
| 59 | + services/eks/ # EKS + K8s resources |
| 60 | + gcp/ # GCP platform (VPC, firewall, Secret Manager, SA) |
| 61 | + services/gke/ # GKE + K8s resources |
| 62 | + services/cloud-run/ # Cloud Run v2 |
| 63 | + azure/ # Azure platform (VNet, NSG, Key Vault, identity) |
| 64 | + services/aks/ # AKS + K8s resources |
| 65 | + services/aci/ # Azure Container Instances |
| 66 | + kubernetes/ # Generic K8s (any cluster, no cloud APIs) |
| 67 | + examples/ |
| 68 | + aws-ecs/ # Deploy on ECS Fargate |
| 69 | + gcp-gke/ # Deploy on GKE |
| 70 | + azure-aks/ # Deploy on AKS |
| 71 | + kubernetes/ # Deploy on any K8s cluster |
| 72 | +``` |
| 73 | + |
| 74 | +## Examples |
| 75 | + |
| 76 | +Each example directory contains `main.tf`, `variables.tf`, `outputs.tf`, `terraform.tfvars.example`, and a `README.md`. |
| 77 | + |
| 78 | +```bash |
| 79 | +cd examples/aws-ecs |
| 80 | +cp terraform.tfvars.example terraform.tfvars |
| 81 | +# Edit terraform.tfvars with your values |
| 82 | +terraform init |
| 83 | +terraform plan |
| 84 | +terraform apply |
| 85 | +``` |
| 86 | + |
| 87 | +## Key Variables |
| 88 | + |
| 89 | +| Variable | Default | Description | |
| 90 | +|----------|---------|-------------| |
| 91 | +| `cloud_provider` | (required) | `"aws"`, `"gcp"`, `"azure"`, or `"kubernetes"` | |
| 92 | +| `service` | (required) | Service type (see table above) | |
| 93 | +| `region` | (required) | Cloud region | |
| 94 | +| `image_tag` | `"latest"` | Bifrost Docker image tag | |
| 95 | +| `desired_count` | `1` | Number of replicas | |
| 96 | +| `cpu` | `512` | CPU units (ECS) or millicores (K8s) | |
| 97 | +| `memory` | `1024` | Memory in MB | |
| 98 | +| `create_load_balancer` | `false` | Create a load balancer | |
| 99 | +| `enable_autoscaling` | `false` | Enable auto-scaling | |
| 100 | +| `create_cluster` | `true` | Create new cluster (set `false` to use existing) | |
| 101 | +| `storage_class_name` | `"standard"` | K8s StorageClass for PVC (generic K8s only) | |
| 102 | +| `ingress_class_name` | `"nginx"` | Ingress controller class (generic K8s only) | |
| 103 | +| `ingress_annotations` | `{}` | Ingress annotations (generic K8s only) | |
| 104 | + |
| 105 | +## Outputs |
| 106 | + |
| 107 | +| Output | Description | |
| 108 | +|--------|-------------| |
| 109 | +| `service_url` | URL to access Bifrost | |
| 110 | +| `health_check_url` | Health endpoint URL | |
0 commit comments