gcp-login
The gcp-login provider enables you to log in to Google Cloud using OpenID Connect or by providing static credentials. The provider will return a set of credentials that can be used to access Google Cloud resources or fetch secrets using the gcp-secrets provider.
Examples
Using outputs with Pulumi IaC
The Pulumi Google Cloud provider reads the project and OAuth access token from the environment. Set the project to the project ID rather than the project output of gcp-login, which is the numeric project number that some Google Cloud APIs, such as Artifact Registry, reject:
values:
gcp:
login:
fn::open::gcp-login:
project: 123456789
oidc:
workloadPoolId: pulumi-esc
providerId: pulumi-esc
serviceAccount: pulumi-esc@foo-bar-123456.iam.gserviceaccount.com
environmentVariables:
# The project ID (e.g. "my-project-12345"), not the numeric project number that gcp-login outputs
GOOGLE_CLOUD_PROJECT: my-project-12345
GOOGLE_OAUTH_ACCESS_TOKEN: ${gcp.login.accessToken}Using outputs with the gcloud CLI
The gcloud CLI reads the project ID (a string identifier, not the numeric project number) and the access token from its own CLOUDSDK_* environment variables, which differ from the ones the Pulumi provider uses:
values:
gcp:
login:
fn::open::gcp-login:
project: 123456789
oidc:
workloadPoolId: pulumi-esc
providerId: pulumi-esc
serviceAccount: pulumi-esc@foo-bar-123456.iam.gserviceaccount.com
environmentVariables:
# CLOUDSDK_CORE_PROJECT takes the project ID string (e.g. "my-project-12345"), not the numeric project number
# See: https://cloud.google.com/sdk/docs/properties#setting_properties_using_environment_variables
CLOUDSDK_CORE_PROJECT: my-project-12345
CLOUDSDK_AUTH_ACCESS_TOKEN: ${gcp.login.accessToken}Schema reference
Inputs
INFO
If you encounter authentication errors with GCP OIDC, see the GCP OIDC troubleshooting guide for common issues and solutions.
Outputs
Configuring OIDC
To learn how to configure OpenID Connect (OIDC) between Pulumi Cloud and Google Cloud, see the OpenID Connect integration documentation.