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
4
Connect in TensorCost
Build → Connect, Cloud tab → Google Cloud Platform → Connect →, 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 Platform → Connect →, switch the auth mode to Workload Identity Federation, and fill in:
Click Verify, then Connect.