Skip to content

Google Cloud Billing source

This event source receives messages from a Google Cloud Billing Budget over a Google Cloud Pub/Sub topic.

With tmctl:

tmctl create source googlecloudbilling --billingAccountId <billingAccountId> --budgetId <budgetId> --pubsub.project <project> --serviceAccountKey=/tmp/test

On Kubernetes:

kind: GoogleCloudBillingSource
  name: sample
  billingAccountId: myBillingAccountId
  budgetId: mybudgetId

    project: my-project
    # Alternatively, provide a pre-existing Pub/Sub topic:
    # topic: projects/my-project/topics/my-topic

    value: >-
        "type": "service_account",
        "project_id": "my-project",
        "private_key_id": "0000000000000000000000000000000000000000",
        "private_key": "-----BEGIN PRIVATE KEY-----\nMIIE...\n-----END PRIVATE KEY-----\n",
        "client_email": "",
        "client_id": "000000000000000000000",
        "auth_uri": "",
        "token_uri": "",
        "auth_provider_x509_cert_url": "",
        "client_x509_cert_url": ""
      kind: RedisBroker
      name: triggermesh

Events produced have the following attributes:

  • type

See the Kubernetes object reference for more details.


  • Billing Account ID: The identifier for the Cloud Billing account owning the budget. For example, 01D4EE-079462-DFD6EC.
  • Budget ID: The identifier for the Cloud Billing budget. You can locate the budget's ID in your budget under "Manage notifications". The ID is displayed after you select Connect a Pub/Sub topic to this budget. For example, de72f49d-779b-4945-a127-4d6ce8def0bb.

Service Account

A Service Account is required to authenticate the event source and allow it to interact with Google Cloud Billing budget.

The service account must be granted an IAM Role with at least the following permissions:

  • billing.budgets.get
  • billing.budgets.update

The following set of permissions is also required to allow this source to manage the Pub/Sub topic and subscription:

  • pubsub.subscriptions.create
  • pubsub.subscriptions.delete

The predefined roles/billing.costsManager and roles/pubsub.editor roles are an example of roles that are suitable for use with the TriggerMesh event source for Google Cloud Billing.

Create a key for this service account and save it. This key must be in JSON format. It is required to be able to run an instance of the Google Cloud Billing event source.

Known Issues

Because the Google Cloud Billing API doesn't allow disabling a Budget's notifications programmatically, budget notifications will remain enabled even after the deletion of the event source. The destination Pub/Sub topic will nevertheless be deleted, effectively causing the interruption of budget notifications.