Google Cloud (GCP) Classic

v6.7.0 published on Thursday, Jan 13, 2022 by Pulumi

Installation

The Google Cloud (GCP) Classic provider is available as a package in all Pulumi languages:

Configuration

To provision resources with the Pulumi Google Cloud Provider, you need to have Google credentials.

When developing locally, we recommend that you install the Google Cloud SDK and then authorize access with a user account.

If gcloud is not configured to interact with your Google Cloud project, set it with the config command using the project’s ID:

gcloud config set project <YOUR_GCP_PROJECT_ID>

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

gcloud auth application-default login

Use pulumi config set gcp:<option> or pass options to the constructor of new gcp.Provider.

Option Required/Optional Description
project Required The ID of the project to apply any resources to. This can also be specified using any of the following environment variables (listed in order of precedence): GOOGLE_PROJECT, GOOGLE_CLOUD_PROJECT, GCLOUD_PROJECT, CLOUDSDK_CORE_PROJECT.
credentials Optional Contents of a file that contains your service account private key in JSON format. You can download your existing Google Cloud service account file from the Google Cloud Console, or you can create a new one from the same page. Credentials can also be specified using any of the following environment variables (listed in order of precedence): GOOGLE_CREDENTIALS, GOOGLE_CLOUD_KEYFILE_JSON, GCLOUD_KEYFILE_JSON. The GOOGLE_APPLICATION_CREDENTIALS environment variable can also contain the path of a file to obtain credentials from. If no credentials are specified, the provider will fall back to using the Google Application Default Credentials. If you are running Pulumi from a GCE instance, see Creating and Enabling Service Accounts for Instances for details.
region Optional The region to operate under, if not specified by a given resource. This can also be specified using any of the following environment variables (listed in order of precedence): GOOGLE_REGION, GCLOUD_REGION, CLOUDSDK_COMPUTE_REGION.
zone Optional The zone to operate under, if not specified by a given resource. This can also be specified using any of the following environment variables (listed in order of precedence): GOOGLE_ZONE, GCLOUD_ZONE, CLOUDSDK_COMPUTE_ZONE.

Use environment variables

We recommend using pulumi config for the options above, but you can also set many of the options above as environment variables instead.

  • 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.