Connecting to GCP
Step-by-step guide to connect a Google Cloud project to a Bluebricks collection, grant discovery permissions, and start cloud resource ingestion
Connect a Google Cloud project to a Bluebricks collection so Bluebricks can inventory cloud resources into the context layer. After you grant the required IAM roles to the Bluebricks service account, discovery ingests your project resources and powers the agent.
Unlike AWS and Azure, GCP connections do not start discovery automatically. You must grant IAM roles on your project first, then trigger ingestion.
Prerequisites
A valid Google Cloud project ID
Permission to grant IAM roles on that project (
roles/resourcemanager.projectIamAdminor equivalent)
How to connect and enable discovery
Copy the service account email
Bluebricks creates one service account per connected project. You grant IAM roles to this account on your project.
Choose Edit on the collection options

Copy the Bluebricks Service Account email (also available in the Cloud Accounts API response as
service_account_email)
Use a unique service account email per project. Do not reuse the same principal across unrelated projects.
Grant discovery permissions
Discovery permissions are required for cloud resource ingestion, the context layer, and the agent. Without these roles, ingestion fails with IAM permission errors.
Grant the following roles to the Bluebricks service account on your Google Cloud project:
Cloud Asset Viewer
roles/cloudasset.viewer
Query Cloud Asset Inventory (required for resource discovery)
Security Reviewer
roles/iam.securityReviewer
Read IAM policies and security configurations
Viewer
roles/viewer
General read-only access to project resources
Open the Google Cloud console and select your project
Search for IAM and open IAM & Admin
Click Grant access
Paste the Bluebricks service account email in New principals
Assign each role from the table above (Cloud Asset Viewer, Security Reviewer, Viewer)
Click Save


Set PROJECT_ID to the Google Cloud project you connected in Bluebricks. Set SA_EMAIL to the Bluebricks service account email from the previous step (format: name@PROJECT_ID.iam.gserviceaccount.com).
Prefer separate commands? Keep the same PROJECT_ID and SA_EMAIL lines above, then run each binding individually with "$PROJECT_ID" and "serviceAccount:${SA_EMAIL}".
Grant GKE permissions
If this project runs GKE workloads, grant one more role so Bluebricks can add live cluster details to your context layer. The agent can then answer questions about what is running inside your clusters, not just that the clusters exist.
Discovery alone lists GKE clusters as cloud resources. This step indexes in-cluster objects such as Pods, Deployments, Jobs, and Ingresses. That gives the agent a fuller picture of your environment.
Kubernetes Engine Viewer
roles/container.viewer
Read GKE clusters and connect to the Kubernetes API
Open IAM & Admin > IAM for your project
Find the Bluebricks service account, or use Grant access if it is not listed yet
Add the Kubernetes Engine Viewer role to the same principal
Click Save
If your shell session is still open from the Grant discovery permissions step, PROJECT_ID and SA_EMAIL are already set. Otherwise, edit and run the full block below:
# Skip these two lines if PROJECT_ID and SA_EMAIL are already set
PROJECT_ID="my-gcp-project-id"
SA_EMAIL="bluebricks-sa@my-gcp-project-id.iam.gserviceaccount.com"
gcloud projects add-iam-policy-binding "$PROJECT_ID" \
--member="serviceAccount:${SA_EMAIL}" \
--role="roles/container.viewer"Grant this role before you trigger discovery in the next steps so the first scan includes GKE workload data. No GKE in this project? Continue to the next step.
For more information, see Kubernetes Integration.
Trigger discovery and verify ingestion
GCP connections do not start discovery automatically. After IAM roles propagate (usually within a few minutes), trigger ingestion:
Ask the agent to refresh cloud resources for your collection, or trigger ingestion through the Cloud Accounts API
Wait for the ingestion job to complete (typically 2 to 5 minutes)
Verify by asking the agent a project-scoped question, for example: "List compute instances in my GCP project" or "What GKE clusters are running?"
If ingestion fails with a Cloud Asset Inventory or IAM permission error, confirm all three discovery roles from the Grant discovery permissions step are granted on the correct project. Failed jobs do not retry automatically after exhausting retries.
Grant orchestration permissions (optional)
If you plan to deploy blueprints through Bluebricks, also grant the Editor role (roles/editor) to the same service account. This allows Bluebricks to create, modify, and destroy infrastructure in your project.
GCP uses the same service account for both discovery and orchestration. See Connect your Cloud for how permission types work across providers.
Open IAM & Admin > IAM for your project
Find the Bluebricks service account
Add the Editor role to the same principal
Click Save
If your shell session is still open from the Grant discovery permissions step, PROJECT_ID and SA_EMAIL are already set. Otherwise, edit and run the full block below:
# Skip these two lines if PROJECT_ID and SA_EMAIL are already set
PROJECT_ID="my-gcp-project-id"
SA_EMAIL="bluebricks-sa@my-gcp-project-id.iam.gserviceaccount.com"
gcloud projects add-iam-policy-binding "$PROJECT_ID" \
--member="serviceAccount:${SA_EMAIL}" \
--role="roles/editor"How to connect via the API
Use the Cloud Accounts API to create a cloud account. Pass the Google Cloud project ID as accountId. The response includes the Bluebricks service account email in cloud_config.
After connecting, grant the IAM roles and trigger discovery using the steps above.
Troubleshooting
For ingestion failures, missing resources, and IAM permission errors, see Cloud Connection Troubleshooting in the Help Center.
Next steps
Connect your Cloud: overview of all cloud connection types and permission models
Kubernetes Integration: live GKE workload indexing through discovery
Agent overview: query your ingested cloud resources
Last updated


