Available on the Enterprise plan.
Prerequisites
- The Cube tenant has OIDC enabled and a
GCPtoken config exists under Admin → OIDC. - IAM access to your GCP project sufficient to create Workload Identity Pools, providers, and service accounts.
- Your tenant slug — the leftmost label of your tenant’s console URL.
Throughout this guide it’s referenced as
<tenant-name>(and the full issuer URL ashttps://<tenant-name>.cubecloud.dev). Substitute your actual slug everywhere it appears.
How GCP federation works
Cube doesn’t talk to GCP STS directly. Instead, it writes a small credential configuration JSON to disk that points the GCP SDK at the OIDC token file. The Google client library handles the two-step exchange internally: You can also skip the impersonation step and grant permissions directly to the federated principal — see Direct federation at the end of this page.Step 1: Create a Workload Identity Pool and provider
Run these once per GCP project. The pool is a container; the provider is what actually trusts your Cube issuer.| Option | Purpose |
|---|---|
--issuer-uri | Cube tenant URL. GCP fetches ${issuer-uri}/.well-known/openid-configuration and JWKS from here. |
--attribute-mapping | Maps the JWT sub to GCP’s google.subject. The mapped subject is what IAM bindings reference when granting impersonation rights. |
--attribute-condition | An optional CEL expression that GCP evaluates on every token exchange. The condition above accepts only deployment-scoped tokens. |
PROJECT_NUMBER is the numeric project number, not the project ID. You can
fetch it with gcloud projects describe PROJECT_ID --format='value(projectNumber)'.
Step 2: Set the deployment identity
Add two env vars to your deployment under Settings → Environment variables:GCP_POOL_AUDIENCE— the full resource URI of the WIF provider you created in Step 1. This becomes theaudclaim on the GCP token Cube mints.GCP_SERVICE_ACCOUNT_EMAIL— the service account that Cube impersonates after federation succeeds. Cube assumes this service account by default for every GCP SDK call inside the deployment.
GCP_SERVICE_ACCOUNT_EMAIL unset.
See Direct federation below.
Step 3: Build the IAM bindings
There are two distinct IAM bindings to set:- Workload Identity User on the impersonated service account — lets
the federated principal call
generateAccessTokenon it. - Resource access (BigQuery, GCS, etc.) on the impersonated service account itself — what the SA is actually allowed to do once Cube is running as it.
--member controls which Cube
deployments / components can impersonate the SA. Patterns mirror the AWS
sub patterns:
| Trust scope | --member |
|---|---|
| One specific deployment, any component | principalSet://iam.googleapis.com/projects/123/locations/global/workloadIdentityPools/cube-pool/subject/cube:deployment:<deployment-id>:component:cube_api |
| Every component of every deployment in the tenant | principalSet://iam.googleapis.com/projects/123/locations/global/workloadIdentityPools/cube-pool/* |
| Only Cube Store, across every deployment | Use a CEL --attribute-condition on the provider that constrains sub to end in :component:cube_store, then bind the whole pool. |
principal:// (singular) form pins to one exact subject; principalSet://
matches a set.
Cube’s default sub claim is cube:deployment:<deployment_id>. To match
the :component:<component> patterns in the table above (or to add
:region:<region>), open your GCP token config in Admin → OIDC and
paste one of these templates into the Subject Claim Format field:
cube:deployment:{deployment_id}:component:{component}— for theprincipalSet://...subject/cube:deployment:<deployment-id>:component:<component>patterns above.cube:deployment:{deployment_id}:component:{component}:region:{region}— to additionally pin a Cube Cloud region.
BigQuery
Create a service account for BigQuery access
Provision a regular GCP service account that will hold the BigQuery
permissions Cube assumes:Note the email —
cube-deployment@PROJECT_ID.iam.gserviceaccount.com —
this is what you’ll set as GCP_SERVICE_ACCOUNT_EMAIL.Grant Cube permission to impersonate the service account
Bind the federated principal to the service account so the deployment’s
OIDC token can impersonate it:
Grant the service account BigQuery permissions
Standard IAM, as if the service account were any normal workload:Tighten these to specific datasets / tables in production. The minimum
set of roles Cube needs to run BigQuery queries is
roles/bigquery.dataViewer plus roles/bigquery.jobUser on the project
the queries run in.Configure the deployment
Set the BigQuery driver and identity env vars on the deployment:The BigQuery driver follows the GCP default credential chain, picks up
the credential config Cube generates, and runs as
cube-deployment@my-project.iam.gserviceaccount.com. No service account
JSON key is ever used.GCS export bucket
If your data source uses an export bucket for pre-aggregation unloads (BigQuery, Snowflake on GCP, etc.), grant the deployment’s service account read / write access to the bucket.Grant the service account bucket access
Add a bucket-scoped IAM binding for the deployment’s service account:
objectAdmin covers reads, writes, and deletes within the bucket. If
you only need writes (e.g. you have a separate process cleaning up old
exports), roles/storage.objectCreator is enough.Configure the export bucket env vars
Point the export bucket env vars at your bucket:The GCS client inside Cube picks up the same default identity. See the
export bucket reference for the full set of
variables.
Direct federation
If you’d rather skip the service account impersonation hop, grant permissions directly to the federated principal and leaveGCP_SERVICE_ACCOUNT_EMAIL unset on the deployment. Cube generates a
credential config that performs only the OIDC-to-federated-token exchange,
and the resulting token is what your code authenticates with.
iam.serviceAccountTokenCreator) only
accept service-account principals, so you may need the impersonation path
for those.
Cube Store CSPS bucket
Cube Store CSPS lets you store pre-aggregations in your own GCS bucket. Cube Store gets a separate OIDC token whosesub claim ends in
component:cube_store, so the IAM bindings can be locked down to that
component — even if the same service account were ever shared with the rest
of the deployment, only Cube Store would be able to impersonate it.
Every Cube Store worker emits a sub of the form
cube:deployment:<deployment-id>:component:cube_store. As with the
deployment identity bindings, how broadly
you share access is controlled by the principalSet member you bind:
…/workloadIdentityPools/cube-pool/*— paired with a provider--attribute-conditionthat constrainssubto end in:component:cube_store, this gives you one service account + one bucket for the whole tenant. Every deployment writes pre-aggregations to the same bucket, isolated by Cube Store’s own per-deployment path prefix. Easiest to operate.…/cube-pool/subject/cube:deployment:<deployment-id>:component:cube_store— per-deployment isolation. Pin access to a single deployment’s Cube Store so its pre-aggregations live in a dedicated bucket no other deployment can touch.
Grant access to the CSPS bucket
Service account impersonation (works with every GCS feature). Give a
service account object access on the bucket, then let the Cube Store
principal impersonate it:Direct federation (no impersonation hop). Grant the Cube Store
principal object access on the bucket directly, and leave the service
account blank in the UI:
roles/storage.objectAdmin covers the reads, writes, lists, and deletes
Cube Store performs as it builds and evicts pre-aggregation partitions.Make Cube Store's sub match
Cube Store only emits the
:component:cube_store subject if your GCP
token config uses a subject claim format that includes the :component:
segment. In Admin → OIDC, set the GCP token config’s Subject Claim
Format to cube:deployment:{deployment_id}:component:{component} (see
Step 3). Update the IAM binding or the
provider’s CEL --attribute-condition before changing the format.Enable CSPS on each deployment
For each deployment that should use this bucket, go to Settings →
Pre-Aggregation Storage on the deployment and:
- Toggle Enable CSPS on.
- Storage Provider: Google Cloud Storage.
- GCS Bucket:
my-csps-bucket. - Service Account Email (optional):
cube-cubestore@my-project.iam.gserviceaccount.com— or leave blank if you granted the Cube Store principal bucket access directly (direct federation). - Workload Identity Provider: the provider resource name (without the
//iam.googleapis.com/prefix),projects/<project-number>/locations/global/workloadIdentityPools/cube-pool/providers/cube.
Verifying the setup
The fastest way to confirm WIF is wired up correctly is the Test connection button on the relevant settings page (data source wizard, CSPS settings). Behind the scenes, Cube issues a real OIDC token, performs the GCP STS exchange, optionally impersonates the service account, and returns a precise error if anything is misconfigured. If the test fails:| Symptom | Likely cause |
|---|---|
Permission iam.serviceAccounts.getAccessToken denied | The Workload Identity User binding on the service account is missing or its --member doesn’t match the deployment’s sub. Double-check the principal URI. |
INVALID_ARGUMENT: Invalid value for audience | GCP_POOL_AUDIENCE doesn’t match the WIF provider’s URI. Re-run gcloud iam workload-identity-pools providers describe and copy the value verbatim. |
The token issuer ... does not match the configured issuer | The provider was created with a different --issuer-uri than your tenant URL, or your tenant slug has changed. Re-create the provider with the correct URL. |
attribute condition ... evaluated to false | The CEL --attribute-condition on the provider rejected the token. Inspect the sub Cube emits and adjust the condition. |
sts.googleapis.com (the token exchange) and iamcredentials.googleapis.com
(the SA impersonation). The Cube subject is included in both, so you can
trace which deployment authenticated against which service account at any
point in time.