跳到正文

Google Cloud Platform (GCP) Setup ​

The Pulumi Google Cloud Platform Provider needs to be configured with Google credentials before it can be used to create resources.

When developing locally, we recommend that you install the Google Cloud SDK and then authorize access access with a user account. If gcloud is not configured to interact with your Google Cloud project, set it through the config command.

bash
gcloud config set project <YOUR_GCP_PROJECT_HERE>

Next, Pulumi requires default application credentials to interact with your Google Cloud resources, so run auth application-default login command to obtain those credentials.

bash
gcloud auth application-default login

注意

If you are using Pulumi in an non-interactive setting (such as a CI/CD system) you will need to configure and use a service account instead.

Optional Settings ​

The Pulumi Google Cloud Platform Provider accepts these environment variables to further configure the provider:

  • GOOGLE_PROJECT - The default project for new resources, if one is not specified when creating a resource
  • GOOGLE_REGION - The default region for new resources, if one is not specified when creating a resource
  • GOOGLE_ZONE - The default zone for new resources, if one is not specified when creating a resource.

If these values are not provided, some resources may require you to provide these values as project, region, or zone properties. You may also set these values per project using pulumi config:

bash
$ pulumi config set gcp:project <your-project-here>
$ pulumi config set gcp:region <your-region-here>
$ pulumi config set gcp:zone <your-zone-here>

文档内容翻译自 Pulumi 官方文档。