Overview
Use this guide to provision core Google Cloud infrastructure for CrewAI Platform with Terraform, then continue with Helm installation.
Request the Terraform files from the CrewAI Factory Engineering team before following this guide.
This flow aligns with the GCP Terraform example in the installer and covers:
- GKE cluster
- Cloud SQL for PostgreSQL
- GCS buckets for data and logs
- Artifact Registry for crew image builds
- Cluster add-ons required by the platform
Prerequisites
- Terraform
>= 1.13.4
gcloud CLI installed and authenticated
gke-gcloud-auth-plugin installed for kubectl access
kubectl and Helm installed
- A GCP project with billing enabled and permissions to create required infrastructure resources
Step 1: Authenticate and Enable APIs
gcloud auth login
gcloud config set project YOUR_PROJECT_ID
gcloud auth application-default login
gcloud services enable compute.googleapis.com \
container.googleapis.com \
sqladmin.googleapis.com \
servicenetworking.googleapis.com \
secretmanager.googleapis.com \
storage-api.googleapis.com \
certificatemanager.googleapis.com
From your crewai-installer checkout, open terraform/examples/gcp/main.tf.
The example uses a GCS backend for remote state:
backend "gcs" {
bucket = "YOUR-UNIQUE-STATE-BUCKET-NAME"
prefix = "terraform/state"
}
- Create the state bucket before running
terraform init.
- For temporary testing only, you can comment out the backend block and use local state.
cd terraform/examples/gcp
cp terraform.tfvars.example terraform.tfvars
Update at least:
project_id
region
gcs_data_bucket_name (globally unique)
gcs_logs_bucket_name (globally unique)
The example also auto-detects the Terraform runner public IP and adds it to cluster authorized networks.
Step 4: Apply Infrastructure
terraform init
terraform plan
terraform apply
After apply, configure kubectl using Terraform output:
terraform output configure_kubectl_command
Use Terraform outputs to build your my-values.yaml:
database_ip -> envVars.DB_HOST
registry_uri -> envVars.CREW_IMAGE_REGISTRY_OVERRIDE
gcs_data_bucket -> object storage bucket setting used in your deployment
For object storage configuration in CrewAI Platform, follow the Configuration Guide and ensure your storage integration matches your GCS access pattern.
Continue with the Installation Guide.
Troubleshooting Notes
- If
terraform init fails, verify backend bucket settings and project access.
- If
kubectl cannot connect to the cluster API, confirm your current source IP is authorized.
- If image pushes fail during crew builds, validate
envVars.CREW_IMAGE_REGISTRY_OVERRIDE points to a writable Artifact Registry path.
Next Steps