c7e75cabe6a3b1680f7ea6fb7916a00742f4d7a7
Gemini Enterprise Agent Platform — Terraform Scaffold
Provisions the infrastructure needed to use the Gemini Enterprise Agent Platform (Vertex AI Agent Engine) on an existing GCP project: required APIs, service accounts, IAM bindings, a GCS artifacts bucket, and an Artifact Registry repository.
Prerequisites
- Terraform >= 1.5.0
- An existing GCP project
gcloudCLI authenticated with permissions to enable APIs and manage IAM
Usage
cp terraform.tfvars.example terraform.tfvars
# edit terraform.tfvars — set your project_id
terraform init
terraform plan
terraform apply
Variables
| Name | Required | Default | Description |
|---|---|---|---|
project_id |
yes | — | Existing GCP project ID |
prefix |
no | gemini |
Short prefix applied to all resource names |
Outputs
| Name | Description |
|---|---|
project_id |
GCP project ID |
agent_sa_email |
Runtime service account email (for apps) |
code_assist_sa_email |
Code Assist enterprise SA email |
What gets created
- 7 GCP APIs enabled (
aiplatform,cloudaicompanion,discoveryengine,dialogflow,secretmanager,iam,cloudresourcemanager) - 2 service accounts — one for app runtime, one for IDE enterprise config
- 4 project IAM bindings
Setting up credentials
Use Application Default Credentials:
gcloud auth application-default login
gcloud config set project <your-project-id>
For workloads running on GCP (Cloud Run, GKE, Compute Engine), attach the service account to the resource — no credentials file needed.
Granting developer access to Gemini Code Assist
# Single user
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:YOU@DOMAIN" \
--role="roles/cloudaicompanion.user"
# Google Group (recommended for teams)
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="group:devs@DOMAIN" \
--role="roles/cloudaicompanion.user"
VS Code setup
- Install the Gemini Code Assist extension from the VS Code Marketplace
- Sign in with a Google account that has
roles/cloudaicompanion.useron the project - In Settings, set Cloud AI Companion: Project to your
project_id
Languages
HCL
100%