Skip to content

Google Cloud (GCP)

  • Spend by service and SKU
  • Vertex AI model-level breakdown
  • Idle VM/disk savings recommendations
  • BigQuery bytes and slot time by user and scheduled query (optional)

Plutus connects to Google Cloud without a service account key. You never create, paste or store a secret key.

  1. Plutus signs a short-lived token (valid for five minutes) that identifies your Plutus account.
  2. Google checks that token against a workload identity pool and provider in your project. The provider only accepts the subject for your Plutus account.
  3. Google returns a short-lived access token for a service account in your project. That service account holds the read-only permissions listed below.

Because there is no key, organizations that block service account key creation (iam.disableServiceAccountKeyCreation, the default for organizations created since May 2024) work without a policy exception.

Method: Workload Identity Federation (BigQuery Billing Export)

GCP has no direct API for historical spend, so Plutus reads a BigQuery export you turn on first.

  • Turn on the export. In the GCP Console, go to Billing → Billing export → BigQuery export and enable Detailed usage cost. Pick or create a BigQuery dataset in the project you will connect. The export only contains usage from the day you enable it, with no historical backfill, and the first data can take up to a day to arrive.
  • The project must be the one that holds the export dataset. The permissions below are granted on a dataset in the same project, so a dataset in a different project isn’t supported.
  • Whoever creates the pool needs permission to do so (for example Workload Identity Pool Admin) and to create roles and service accounts in the project.
  • These APIs must be enabled in the project: IAM (iam), IAM Service Account Credentials (iamcredentials), Security Token Service (sts), BigQuery, Recommender, Compute Engine, Cloud Asset (cloudasset) and Cloud Monitoring (monitoring). The Terraform module enables them unless you set enable_apis = false. It also uses the Cloud Resource Manager API.
  1. In Plutus, go to Connect > Sources, find Google Cloud and open the connection form. Under Workload identity setup, copy the tenant key. The form also shows the issuer and subject that the tenant key produces. The tenant key isn’t a secret.

  2. Apply the Plutus customer-role Terraform module to your project:

    module "plutus" {
    source = "./customer-role"
    plutus_tenant_key = "<tenant key from Plutus>"
    project_id = "my-billing-project"
    billing_export_dataset = "billing_export" # the dataset the export writes to
    }
    output "plutus_connection" {
    value = {
    project_number = module.plutus.project_number
    pool_id = module.plutus.pool_id
    provider_id = module.plutus.provider_id
    service_account_email = module.plutus.service_account_email
    }
    }

    Leave jwks_json unset unless Plutus support gives you a key set to paste in.

    If you don’t use Terraform, create the same resources by hand: a workload identity pool, an OIDC provider with issuer https://oidc.plutus-cloud.com/t/<tenant key>, attribute mapping google.subject = assertion.sub and attribute condition assertion.sub == "plutus-account-<tenant key>", a service account, and the grants in the table below.

  3. In the Plutus form, fill in:

    • GCP Project ID: the project that owns the BigQuery billing export dataset.
    • Billing Account ID: found under Billing → Account management.
    • BigQuery Dataset: the dataset the billing export writes into. Enter the dataset name only. The module’s billing_export_dataset output shows project:dataset, so drop the project and the colon.
    • GCP Project Number: the number (not the ID) of the project that holds the workload identity pool. It’s an output of the module and shown on the project dashboard.
    • Workload Identity Pool ID, Workload Identity Provider ID and Service Account Email: outputs of the module. The module’s defaults are pool plutus, provider plutus and service account plutus-reader.
    • Carbon Footprint Dataset (optional): enables emissions tracking. Set up Billing → Carbon footprint → Export to BigQuery first, or leave this blank if the carbon export is in the same dataset as the billing export. GCP publishes location-based and market-based emissions, and Plutus stores both separately. They aren’t comparable and are never summed.
  4. Save the connection.

A new pool, provider or grant can take a minute or two to take effect. While a connection has never synced, Plutus retries automatically for about two and a half minutes before it reports an error. Two exceptions to expect:

  • Right after terraform apply, a first attempt that fails with a temporary error is normal.
  • The first apply can fail once with “Role … does not exist in the resource’s hierarchy”, because a new custom role hasn’t propagated yet. Run terraform apply again after about a minute.

Savings recommendations populate automatically once the permissions below are in place.

If you connected GCP before the resource inventory, utilization and the newer recommenders (idle IP address, idle custom image, Cloud SQL idle and overprovisioned, Cloud Run cost) were added, run terraform apply with the current module to pick up their permissions. Until you do, nothing breaks: costs and the original recommendations keep syncing, and each newer read is refused on its own and recorded as not collected.

Everything is read-only. Plutus can’t create, change or delete anything in your project, and can’t read any dataset other than the billing export dataset. The module uses custom roles that list only the permissions Plutus uses, rather than the broader predefined roles (roles/bigquery.dataViewer, roles/recommender.viewer, roles/compute.viewer, roles/cloudasset.viewer, roles/monitoring.viewer, roles/iam.workloadIdentityUser).

Grant Scope Permissions Why
plutusTokenCreator The Plutus service account, granted to Plutus’s federated identity only iam.serviceAccounts.getAccessToken Lets Plutus obtain a short-lived token for the service account. This is the only impersonation permission.
plutusBillingDatasetReader The billing export dataset only bigquery.datasets.get, bigquery.tables.get, bigquery.tables.getData, bigquery.tables.list Reads the billing export tables.
plutusCostReader Project bigquery.jobs.create Running a query requires it, and it can’t be granted on a dataset.
compute.zones.list Lists zones so Plutus knows which regions to ask for recommendations.
recommender.computeInstanceMachineTypeRecommendations.{get,list}, recommender.computeInstanceIdleResourceRecommendations.{get,list}, recommender.computeDiskIdleResourceRecommendations.{get,list}, recommender.usageCommitmentRecommendations.{get,list}, recommender.computeAddressIdleResourceRecommendations.{get,list}, recommender.computeImageIdleResourceRecommendations.{get,list}, recommender.cloudsqlIdleInstanceRecommendations.{get,list}, recommender.cloudsqlOverprovisionedInstanceRecommendations.{get,list}, recommender.runServiceCostRecommendations.{get,list} Savings recommendations from nine recommenders: VM machine type, idle VM, idle disk, committed use, idle IP address, idle custom image, Cloud SQL idle, Cloud SQL overprovisioned and Cloud Run cost.
cloudasset.assets.searchAllResources, serviceusage.services.use The resource inventory: one Cloud Asset Inventory search lists the project’s instances, disks, addresses, snapshots, forwarding rules, Cloud SQL instances, buckets and Cloud Run services. It reads configuration, not data. Cloud Asset Inventory also requires serviceusage.services.use on the project the call is billed to.
monitoring.timeSeries.list Instance CPU, network and disk metrics, for rightsizing.

The Terraform module also creates the pool, the provider and the service account. The provider’s attribute condition accepts only the subject for your Plutus account, so a token for another Plutus account is rejected.

One Google Cloud connection can read every project you choose. There’s still one connection and one entry on the Sources page. Where you grant the Plutus role decides which projects Plutus can reach: a single project, a folder, or the whole organization.

Spend doesn’t depend on this. The billing export covers the whole billing account, so spend for every project on it is already in your totals, grouped by project. Reading several projects adds the per-project reads: savings recommendations and BigQuery job usage.

Multi-project reading is on for every account. Nothing needs enabling in Plutus. What decides whether Plutus reads more than the connected project is the role you grant, as described below. A connection whose role can’t list projects behaves as before: Plutus reads the one project, shows no error and runs no extra BigQuery queries unless you turned on job usage. If you don’t want Plutus to list projects at all, ask support to opt your account out.

Grant the role at a folder or the organization

Section titled “Grant the role at a folder or the organization”
  1. Open the Google Cloud connection form. Under Workload identity setup, find Which projects Plutus reads.
  2. Pick Every project in a folder or Every project in the organization. The default is This project only.
  3. Enter the Organization ID. For a folder, also enter the Folder ID.
  4. Copy the generated Terraform and apply it. It now includes a second block that creates a custom role, plutusOrgReader, and binds it to the same service account.

A folder can’t own a custom role, so for a folder the role is created at the organization and bound on the folder. The scope choice only shapes the Terraform. Plutus doesn’t save it with the connection. To go back to one project, delete the added block and apply again.

If you use the customer-role-org module instead of the generated Terraform, pass the service account email from the first module:

module "plutus_org" {
source = "./customer-role-org"
organization_id = "123456789012"
service_account_email = module.plutus.service_account_email
}

To scope the module to a folder, set folder_id and parent_organization_id instead.

The role is read-only and holds these permissions:

Permission Used for Needed at
resourcemanager.projects.get, resourcemanager.projects.list Finding the projects under the scope (Cloud Resource Manager projects.search) The organization or folder
compute.zones.list Knowing which locations to ask Recommender about Each project
The nine recommender.* permission families the project role grants Savings recommendations Each project
cloudasset.assets.searchAllResources Listing the project’s resources for the remediation checks Each project
monitoring.timeSeries.list Reading instance utilization Each project
bigquery.jobs.list, bigquery.jobs.listAll (only with BigQuery Job Usage on) BigQuery job usage per project Each project
bigquery.transfers.get (only with Scheduled Query Owners on) Naming the owner of each scheduled query Each project

bigquery.jobs.listAll exposes every BigQuery job in scope, including query text, so it’s off unless you turn on BigQuery Job Usage (or set include_bigquery_job_usage = true in the module). The module’s include_scheduled_query_owners variable adds bigquery.transfers.get. See BigQuery job usage.

Creating the role needs Organization Role Administrator and Organization Administrator, or a folder admin for a folder binding. The Recommender and Compute Engine APIs must be enabled in each project you want read, and bigquerydatatransfer.googleapis.com for scheduled query owners. Billing data is still read only from the one export dataset. The organization role doesn’t include serviceusage.services.use: Cloud Asset Inventory needs it only on the connected project, which the project role already grants.

A role created before the resource inventory, utilization and the newer recommenders were added doesn’t have their permissions. Run terraform apply with the current module to add them. Until you do, each of those reads is refused on its own and the rest of the sync carries on.

You can decline the discovery permissions. A role without the two resourcemanager permissions behaves like a single-project connection, with no error.

On each Google Cloud sync, with multi-project on, Plutus:

  1. Syncs the connected project as usual.
  2. Lists the projects the service account can see. It stores only each project’s ID, number, display name, lifecycle state and parent. It never reads labels or tags.
  3. Reads recommendations and, if enabled, BigQuery job usage in each project.
  • A failed listing changes nothing. If the listing fails, comes back empty or is cut short, Plutus keeps the previous project list and adds a warning to the sync.
  • A project that leaves the list is removed. A project missing from a successful listing is deleted from Plutus along with its data. The project you connected is never removed. A project Google reports as pending deletion shows as Deleted.
  • A sync reads at most 25 projects. The connected project is always read. The others go oldest-read first, three at a time, with 3 minutes per project and 10 minutes per step. A project the step doesn’t reach goes first on the next sync.
  • One project failing doesn’t stop the others. Each project records its own status.

The Projects panel appears on the Google Cloud connection page once Plutus has found projects. It shows a summary such as “7 of 12 projects readable, 2 excluded”, then one row per project: its name, project ID, a Connected badge on the project you connected, a status badge, what to do about it, Google’s error text if any, and when Plutus last read it.

Status Meaning What to do
Readable A read of the project succeeded. Nothing.
Access denied Plutus can list the project but not read it. Google also answers this way for a project that doesn’t exist. Check that the Plutus role is bound at the organization or folder that holds the project, and that no organization policy or deny rule blocks it.
Deleted Google reports the project as deleted or pending deletion. Nothing. It leaves the list once Google stops returning it.
API off An API Plutus reads is turned off in the project. Enable the Recommender, Compute Engine and Cloud Monitoring APIs there, or exclude the project.
Excluded You excluded the project. Plutus doesn’t read it. Include it again to read it.
Not read yet A new project, or the last read failed for a reason that says nothing about access, such as a timeout. Nothing. Plutus reads it on the next sync.

Each project except the connected one has an Include switch. You need the member role or higher to change it.

  • Excluding a project deletes what Plutus stored for it: its recommendations, inventory and usage rows. Stored usage rows are removed on the next sync. Spend stays in your totals, because it comes from the billing export, not from the per-project reads.
  • Including a project again brings it back on the next sync.
  • The connected project can’t be excluded. Disconnect the source to stop reading it.
  • The same choice is available through the REST API (GET /v1/accounts/<account-id>/gcp/projects and PATCH on .../gcp/projects/<project-id> with { "included": false }) and the MCP tools list_gcp_projects and set_gcp_project_included.
  • Both changes appear in the activity log as “GCP Project Excluded” and “GCP Project Included”.

What happens when a project can’t be read

Section titled “What happens when a project can’t be read”
  • Recommendations stay open. Plutus keeps the open recommendations of a project it couldn’t read this sync, whatever the reason, instead of resolving them.
  • Job usage is replaced only by a complete read. If reading a project or region fails for a reason that isn’t a clear permission error, such as a timeout, Plutus writes no job usage for that sync and leaves the stored rows as they were.
  • A permission error in another project skips that project. The sync adds a warning such as “Job usage skipped for my-project: it needs the bigquery.jobs.listAll permission there”, and the other projects are written. A permission error in the connected project follows the single-project behavior and writes nothing.

Plutus runs the job usage queries from the connected project, one per project and region, and reads each other project’s metadata through a project-qualified INFORMATION_SCHEMA view. The connected project therefore needs bigquery.jobs.create, which the project role already grants.

Plutus shows these messages on the connection when a sync or test fails.

Message (start of) Cause Fix
Google Cloud needs the project number, workload identity pool ID, provider ID and service account email One of those fields is empty, so the connection is missing the keyless values. Fill in the missing fields from the Terraform outputs.
Google rejected the Plutus identity: the provider’s attribute condition does not match this Plutus account The tenant key in the provider’s condition isn’t the one for this Plutus account. Use exactly the tenant key shown in the Plutus form for plutus_tenant_key, then re-apply.
Google rejected the Plutus token because its audience does not match the provider Project number, pool ID or provider ID in Plutus doesn’t match the provider. Compare the three fields against the module output.
Google rejected the Plutus token because the provider’s issuer URI does not match The provider’s issuer isn’t https://oidc.plutus-cloud.com/t/<tenant key>. Fix issuer_uri to use your tenant key and re-apply.
Google could not verify the Plutus token signature The provider holds an uploaded key set (jwks_json) that doesn’t match Plutus’s current key. Remove jwks_json so Google reads the keys from the issuer, or update it to the current key set. If it persists, contact support.
Google rejected the Plutus token as stale Clock problem on the Plutus side. Contact support.
The workload identity pool or provider was not found Wrong IDs, a pool that isn’t enabled, a required API that’s off, or a pool created in the last couple of minutes. Check the IDs, that the pool is enabled, and that sts, iam and iamcredentials are enabled in the project. Wait two minutes if it’s new.
The Plutus identity was accepted but is not allowed to impersonate the service account The federated identity has no role with iam.serviceAccounts.getAccessToken on the service account, or the grant is still propagating. Reapply the module, or grant plutusTokenCreator to the Plutus principal on the service account. Wait a couple of minutes.
A Google API this connection needs is disabled An API is off in the project that holds the pool. Enable sts.googleapis.com, iam.googleapis.com and iamcredentials.googleapis.com.
Google rejected the Plutus token. Check the workload identity provider settings Another invalid_grant failure. Compare the provider’s settings against the module output.

If your organization restricts allowed workload identity providers (iam.workloadIdentityPoolProviders), allow https://oidc.plutus-cloud.com/t/<tenant key>, or the provider can’t be created.

The billing export says what BigQuery cost. Job usage says what caused it: which user, scheduled query or query shape scanned the bytes, and in which region. It’s off by default, because it needs bigquery.jobs.listAll, which exposes job metadata, including query text, for every user in the project.

Turn it on in the connection form. Three optional fields sit at the end:

Field Values What it does
BigQuery Job Usage (optional) Off (default), On Reads job metadata from INFORMATION_SCHEMA.JOBS_BY_PROJECT. Adds bigquery.jobs.list and bigquery.jobs.listAll to the generated Terraform.
Scheduled Query Owners (optional) Off (default), On Names the owner of each scheduled query. Adds bigquery.transfers.get and needs the BigQuery Data Transfer API (bigquerydatatransfer.googleapis.com) enabled.
BigQuery Job Regions (optional) Comma-separated regions, for example asia-southeast2, us Reads exactly these regions and skips discovery. Leave blank to let Plutus find them.

The generated Terraform under Workload identity setup follows the two toggles. Set them, then copy the snippet and apply it, then save the connection. The form shows what you saved when you reopen it: a toggle you turned on reads On, and an untouched one reads Off. Clearing BigQuery Job Regions and saving goes back to automatic discovery.

You can also change these settings without re-entering credentials. GET and PATCH /v1/accounts/<account-id>/connections/gcp/usage-settings (or the MCP tools get_gcp_usage_settings and set_gcp_usage_settings) read and set the two toggles and the regions. A field you leave out keeps its value, and an empty value clears it. The next sync applies the change. Changing the toggles doesn’t change the Terraform grants, so apply the matching Terraform too.

Plutus writes two usage metrics for the Google Cloud source, one row per UTC day and combination of dimensions:

  • gcp.bigquery.bytes_billed (bytes) and gcp.bigquery.slot_ms (milliseconds of slot time).
  • Dimensions: region, project_id, user_email, dts_config_id (the scheduled query), query_hash, and dts_owner_email and dts_name when the owner lookup ran.

query_hash is BigQuery’s own normalized query hash, so the same query with different literals groups together. The data appears in Usage Explorer. The newest complete day is yesterday, in UTC.

  • Script parents are excluded. A script’s bytes already include its child jobs, so counting both would double the total.
  • The largest 300 combinations per day keep their query_hash. The rest fold into query_hash = other, per region, project, user and scheduled query. Totals don’t change.
  • History reaches back 180 days. That is how long BigQuery keeps job metadata.
  • A region Plutus can’t read writes nothing. A half-read window never replaces a complete one.

A query must run in the region it reads. Plutus uses the regions in BigQuery Job Regions if you set it. Otherwise it uses the billing dataset’s location plus the locations of recent jobs. A region with no jobs in the window isn’t read.

After each sync, Plutus compares job bytes with the export’s BigQuery analysis line for the same UTC days. A gap over 5% adds a data health warning. Plutus never scales the numbers to close a gap.

Plutus stores at most 1e18 per day and query group for a job usage value. A larger value, which points to a unit error or a runaway sum, is clamped to the limit. A value that isn’t a finite number is not written. Neither case fails the sync: Plutus writes the other rows and adds a warning that states how many values were clamped or skipped. The reconciliation above uses the true totals, so clamping doesn’t affect it.

A missing grant never fails the cost sync. The sync finishes, and the reason, such as “Job usage needs the bigquery.jobs.listAll permission”, shows in data health. Re-apply the Terraform with the option on to fix it.

Each region costs one INFORMATION_SCHEMA query per run, plus one export query. Google bills the bytes scanned to your project, and bills at least 10 MB per query. The sync rate controls how often this runs. See Sync rate.

You can alert on job usage, for example when bytes billed drifts from a pinned baseline.

  • One provider per Plutus account. Google matches the issuer exactly, and the issuer includes the tenant key. If a second Plutus account connects to the same project, call the module again with a different tenant key and different pool_id, service_account_id and role ID variables.
  • Audit logs. BigQuery jobs show your service account as the principal. Plutus’s identity appears in serviceAccountDelegationInfo[].principalSubject as plutus-account-<tenant key>.
  • Pool IDs. Google doesn’t let you reuse a deleted pool ID for 30 days.
  • Revoking access. Run terraform destroy, or delete the provider or the impersonation binding. New tokens stop within about two minutes. There’s no key to revoke.
  • Moving from a JSON key. Connections that used a service account JSON key need the fields above. Apply the module, update the connection, then delete the old key and service account in your project.