Skip to main content

Connect GCP infrastructure cost

This connects a GCP project for infrastructure spend, read from your BigQuery billing export — GCP has no other API surface for project-level spend, so this export is required either way. You choose between two ways for TensorCost to authenticate: If you try the service account key path and key creation fails with an organization-policy error, switch to WIF — it doesn’t need the permission that policy blocks.

Prerequisites

  • Billing export enabled. In the GCP Console, go to Billing → Billing export → BigQuery export and turn on Detailed usage cost. Note the project ID and dataset ID it writes to — you’ll need both regardless of auth mode.
  • For the WIF path: Terraform ≥ 1.5 and the Google provider, and permission to create IAM bindings, a Workload Identity Pool, and a service account in the billing project.
  • For the service account key path: permission to create a service account and IAM bindings in the billing project (roles/owner, or the narrower IAM-admin + BigQuery-admin roles).

Path A — Service account key

1

Create a service account

In the GCP project that holds your billing export:
2

Grant it read access to the export

bigquery.jobUser lets it run the read query; bigquery.dataViewer on the dataset lets it read the export rows. Nothing broader.
3

Create and download a key

This file contains a long-lived private key. Treat it like a password — paste it into the TensorCost connect form and then delete the local copy; don’t commit it anywhere.
If this command fails with an organization-policy error, your org blocks service-account key creation — skip to Path B (WIF) below instead.
4

Connect in TensorCost

Build → Connect, Cloud tab → Google Cloud PlatformConnect →, leave the auth mode on Service account key, and fill in:Click Verify, then Connect.

Path B — Workload Identity Federation (no key)

WIF exchanges a short-lived token for GCP access instead of a downloadable key — nothing to leak, rotate, or accidentally commit.
1

Run the onboarding Terraform module

We provide a Terraform module for this — ask your TensorCost contact for the source if you don’t already have it. Apply it in WIF mode:
This creates a Workload Identity Pool and provider trusting TensorCost’s OIDC issuer, a service account scoped to this project, and grants that service account roles/bigquery.dataViewer on your export dataset and roles/bigquery.jobUser on the project. No key material is created at any point.
2

Connect in TensorCost

Build → Connect, Cloud tab → Google Cloud PlatformConnect →, switch the auth mode to Workload Identity Federation, and fill in:Click Verify, then Connect.

What Verify actually checks

Both modes mint a real token — a JWT signed with your key in Path A, or a full Workload Identity Federation token exchange plus service-account impersonation in Path B — and, once you’ve filled in the BigQuery dataset field, confirm it can actually read that dataset. An identity that mints fine but is explicitly denied dataset access fails Verify; a token that can’t be confirmed due to a network hiccup on TensorCost’s side degrades to a pass with a warning, rather than blocking you for something that isn’t your misconfiguration.

Common failures