-
Notifications
You must be signed in to change notification settings - Fork 261
Description
Problem description
When configuring GCP OIDC authentication with Pulumi ESC, users may encounter a misleading error message about an invalid audience value:
oauth2/google: status code 400: {"error":"invalid_request","error_description":"Invalid value for \\"audience\\". This value should be the full resource name of the Identity Provider."}
However, the actual root cause can be an incorrect region value in the ESC environment configuration. GCP Workload Identity Pools are always global resources, so the region field (if specified) must be global, not a regional value like us-central1.
The issue is that Pulumi ESC uses the region field to construct the Workload Identity URL internally. When set to a regional value (e.g., us-central1), the URL becomes:
//iam.googleapis.com/projects/PROJECT_NUMBER/locations/us-central1/workloadIdentityPools/POOL_ID/providers/PROVIDER_ID
When it should be:
//iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/providers/PROVIDER_ID
Affected documentation pages:
-
https://www.pulumi.com/docs/esc/integrations/dynamic-login-credentials/gcp-login/
- The
regionfield in theGCPLoginOIDCtable (line 95) is documented as "[Optional] - The region of the GCP project" but doesn't clarify that:- For Workload Identity Pools, this should be
global(or omitted) - Setting a regional value will cause authentication failures with misleading error messages
- For Workload Identity Pools, this should be
- The
-
https://www.pulumi.com/docs/esc/guides/configuring-oidc/gcp/
- The OIDC configuration guide doesn't mention the
regionfield at all, which could lead users to assume they should use their project's region
- The OIDC configuration guide doesn't mention the
Suggestions for a fix
-
Update the
gcp-loginprovider documentation to clarify theregionfield:- Change the description from "The region of the GCP project" to something like: "The location of the Workload Identity Pool. For standard Workload Identity Pools, this should be
global(the default). Only specify a regional value if you have explicitly created a regional Workload Identity Pool." - Add a note/warning that incorrect region values will cause authentication failures with misleading "invalid audience" errors
- Change the description from "The region of the GCP project" to something like: "The location of the Workload Identity Pool. For standard Workload Identity Pools, this should be
-
Add a troubleshooting section to the GCP OIDC guide mentioning this common pitfall:
- If you see "Invalid value for audience" errors, verify that the
regionfield is set toglobalor omitted entirely - Explain that the region is used to construct the Workload Identity URL, so regional values will produce invalid URLs
- If you see "Invalid value for audience" errors, verify that the
-
Consider adding a validation warning in Pulumi ESC itself when a non-global region is specified for GCP OIDC (separate enhancement request)
Debugging tip for users
Running a pre-run command that dumps GOOGLE_CREDENTIALS can help identify this issue - look for locations/us-central1 (or other regional values) in the credential JSON when it should be locations/global.