Skip to main content
Available on the Enterprise plan. Contact sales to learn more.
Ona environments can access Google Cloud resources using Workload Identity Federation. You create a workload identity pool with an OIDC provider that trusts Ona’s tokens, then grant the federated identity access to GCP resources. No service account keys are needed.

Prerequisites

How it works

  1. Ona issues a JWT with claims about the environment, user, and organization.
  2. The environment sends the JWT to Google’s Security Token Service (STS).
  3. STS validates the token against Ona’s OIDC discovery endpoint and returns a federated access token.
  4. The environment uses the federated token to access GCP resources directly, or impersonates a service account for broader access.

Step 1: Create a workload identity pool

Create a workload identity pool to manage Ona’s federated identities:

Step 2: Create an OIDC provider

Add an OIDC provider to the pool that trusts Ona’s tokens:
Key parameters:

Attribute mappings

Attribute mappings define how Ona token claims map to GCP identity attributes. google.subject is required. Additional custom attributes enable fine-grained IAM bindings. Common mappings for V3 tokens:

Attribute conditions

Attribute conditions restrict which tokens the provider accepts. Use CEL expressions to filter on Ona claims. Allow only a specific Ona organization:
Allow only a specific project:
Allow only environments created by a specific user:
Always set an attribute condition. Without one, any valid Ona token from any organization can authenticate to your pool.

Step 3: Grant access to GCP resources

You can grant access using direct resource bindings or service account impersonation.

Option A: Direct resource access

Grant the federated identity access directly on a GCP resource:
To restrict to a specific Ona project, use the attribute.project_id attribute:
To restrict to a single identity (specific sub claim):

Option B: Service account impersonation

If the GCP APIs you need do not support direct Workload Identity Federation, impersonate a service account instead.
  1. Create a service account:
  1. Grant the federated identity permission to impersonate the service account:
  1. Grant the service account access to the resources it needs:

Step 4: Authenticate from an environment

Create a credential configuration file

Create a credential configuration file that tells the GCP SDK how to obtain tokens from Ona:
For service account impersonation, add the --service-account flag:

Authenticate

Set the GOOGLE_APPLICATION_CREDENTIALS environment variable and enable executable-based credentials:
Then use GCP tools normally:

Automate on environment startup

Add the credential setup to your automations:
Store the credential configuration file in your repository or generate it during environment startup. It does not contain secrets, only the configuration for how to obtain tokens.

Using V2 tokens with GCP

V2 tokens also work with GCP Workload Identity Federation. The V2 sub claim uses a path-based format (e.g., org:<orgID>/prj:<projectID>/env:<envID>). Adjust your attribute mappings and conditions accordingly. V2 tokens include fewer claims (org, gsub, and standard JWT fields), so attribute mappings are limited to google.subject=assertion.sub and conditions on assertion.sub or assertion.org. See the OIDC overview V2 section for the full V2 sub format reference.

Further reading

Troubleshooting

  • The --audience in ona idp token must match the --allowed-audiences on the OIDC provider. Use the full provider resource name.
  • Your token’s claims do not satisfy the --attribute-condition CEL expression.
  • Decode your token: ona idp token --audience <AUDIENCE> --decode
  • Verify the organization_id, project_id, or other claims match the condition.
  • The federated identity or service account does not have the required IAM role on the target resource.
  • Check the --member format in your IAM binding. For principalSet://, the attribute value must match exactly.
  • The ona idp token command failed. Verify the CLI is installed and authenticated in the environment.
  • Check that the audience value is correct.