Skip to main content
Version: Preview

Connect Google Cloud

Catalog BigQuery every 6 hours with a pipeline that authenticates to Google Cloud as itself, so there's no service account key to create, store or rotate.

Before you start​

  • You hold ingestion.admin across the whole catalog in your instance.
  • You have a Google Cloud project where you can create Workload Identity pools and IAM bindings. This page calls it analytics-prod.

How it works​

Before each run, your instance gives the pipeline a 5-minute token with the subject pipeline:<pipeline-name>. Workload Identity Federation exchanges it for Google credentials, so you grant each pipeline exactly the access it needs. Keyless pipelines explains the model.

Values you'll need​

The steps use these values. Replace <instance> and <project-number> with your own:

  • Issuer URL: https://<instance>.marmotdata.cloud, with no trailing slash. Always the marmotdata.cloud address, even with a custom domain
  • Pool: projects/<project-number>/locations/global/workloadIdentityPools/marmot, written $POOL below. It uses the project number, not the project ID
  • Provider: $POOL/providers/marmot
  • Pipeline principal: principal://iam.googleapis.com/$POOL/subject/pipeline:analytics

The commands read the pool from a shell variable:

POOL=projects/<project-number>/locations/global/workloadIdentityPools/marmot

Your first pipeline​

  1. Trust your instance

    Create one Workload Identity pool with an OIDC provider for your instance. Keep the default audience.

    1. Open IAM & Admin → Workload Identity Federation and create a pool named marmot.
    2. Under Select a provider, choose OpenID Connect (OIDC), name it marmot and enter the issuer URL.
    3. Under Configure provider attributes, map google.subject to assertion.sub and select Save.
  2. Grant the pipeline access

    Grant the pipeline principal roles/bigquery.metadataViewer on the project. It reads dataset and table structure but no rows.

    1. Open IAM & Admin → IAM for analytics-prod and select Grant access.
    2. Enter the pipeline principal in New principals.
    3. Choose BigQuery Metadata Viewer and select Save.
  3. Create the pipeline

    Point the BigQuery plugin at your project and set the provider. The provider is what tells the plugin to sign in as the pipeline rather than look for a key.

    1. Open Plugins and select Google BigQuery under Add a source.
    2. Enter analytics as the Pipeline name and select Continue.
    3. Set Project ID to analytics-prod and Workload Identity Provider to the provider, leave the key fields empty and select Check and continue.
    4. Turn on Run on a schedule, set it to 0 */6 * * * and select Create pipeline.
    The BigQuery pipeline's connection settings with Project ID analytics-prod and the Workload Identity Provider filled in and no keyThe BigQuery pipeline's connection settings with Project ID analytics-prod and the Workload Identity Provider filled in and no key

Check that it worked​

The pipeline runs at its next scheduled time. To run it now, open it under Plugins and select Run now. When the run succeeds, your datasets and tables appear in Discover.

From the CLI, marmot runs list --pipelines analytics lists its runs.

Other Google Cloud sources​

Every other Google Cloud plugin works the same way: set the provider in its config and grant the pipeline principal a read-only role. For Cloud Storage that's roles/storage.bucketViewer on the project. Each plugin's page in the plugin directory lists its configuration.

When a source needs a password​

A Cloud SQL or self-managed Postgres can't federate, so its pipeline needs a real password. Keep it in Secret Manager and let Marmot read it at run time through a secret store. The store signs in through the same pool, as the subject secretStore:<store-name>.

  1. Grant the store the secret

    Grant roles/secretmanager.secretAccessor on the one secret, not the project. The store will be called gcp-prod.

    1. Open Secret Manager and select the checkbox next to orders-db-password.
    2. In the info panel, select Add Principal and enter principal://iam.googleapis.com/$POOL/subject/secretStore:gcp-prod with your pool in place of $POOL.
    3. Choose Secret Manager Secret Accessor and save.
  2. Create the store and register the secret

    Create a store named gcp-prod that signs in through the same provider, then register the secret in it.

    1. Open Settings → Secret stores and select New secret store.
    2. Enter gcp-prod as the Name and choose Google Secret Manager under Where do the secrets live?.
    3. Set Workload Identity Provider to the provider and select Create secret store.
    4. On the store's page, select Register secret, enter analytics-prod as the Project and orders-db-password as the Secret ID, then select Register secret.
    The New secret store form named gcp-prod, with Google Secret Manager chosen, the Workload Identity Provider filled in and the subject secretStore:gcp-prodThe New secret store form named gcp-prod, with Google Secret Manager chosen, the Workload Identity Provider filled in and the subject secretStore:gcp-prod
  3. Use the secret in a pipeline

    Create the PostgreSQL pipeline with its password read from the store. No version is pinned, so rotating the password is adding a version in Secret Manager.

    1. Open Plugins and select PostgreSQL under Add a source.
    2. Enter orders as the Pipeline name and select Continue.
    3. Fill in Host and User. For Password, choose From secret store and pick the secret.
    4. Select Check and continue, set a schedule and select Create pipeline.
    The PostgreSQL pipeline's connection settings with the password read from the orders-db-password secret in gcp-prodThe PostgreSQL pipeline's connection settings with the password read from the orders-db-password secret in gcp-prod

Troubleshooting​

What you seeWhat to do
workload_identity_provider must name a provider as projects/<number>/...Use the project number in the provider, not the project ID.
The token exchange is rejectedCheck the provider's issuer is exactly the issuer URL above.
The exchange succeeds but the API call is deniedThe binding names a different subject, usually after a rename. Grant pipeline:<pipeline-name> again.
Everything is denied right after you grant accessIAM changes take a few minutes to propagate. Wait and run the pipeline again.

Next steps​