1. Docs
  2. Infrastructure as Code
  3. Get Started
  4. Google Cloud
  5. Configure access

Get started with Pulumi and Google Cloud

    Configure access to Google Cloud

    Pulumi’s CLI needs access to your Google Cloud account to manage cloud resources.

    If you’ve already installed and initialized the gcloud CLI, Pulumi will respect and use your configuration settings.

    You must use a Google Cloud account that has rights to deploy and manage resources, such as Cloud Storage buckets.

    Testing access

    To test that your Google Cloud access is configured properly, run:

    $ gcloud config list
    
    > gcloud config list
    

    If your active account and project are printed, your configuration is correct. If not, read on:

    [core]
    account = user@example.com
    disable_usage_reporting = True
    project = my-gcp-project
    
    Your active configuration is: [default]
    

    You can also verify your authentication status:

    $ gcloud auth list
    
    > gcloud auth list
    

    Alternative approaches

    If you don’t have the gcloud CLI installed, or you plan on using Pulumi in a CI/CD pipeline, you can create a service account and download a JSON key file. Then set the GOOGLE_CREDENTIALS environment variable on your workstation:

    $ export GOOGLE_CREDENTIALS="$(cat ~/path/to/service-account-key.json)"
    
    > $env:GOOGLE_CREDENTIALS = (Get-Content -Path "C:\path\to\service-account-key.json" -Raw)
    

    Alternatively, you can set the path to the key file:

    $ export GOOGLE_APPLICATION_CREDENTIALS="$HOME/path/to/service-account-key.json"
    
    > $env:GOOGLE_APPLICATION_CREDENTIALS = "C:\path\to\service-account-key.json"
    
    Consider using Pulumi ESC’s Google Cloud login support for dynamic, short-lived Google Cloud credentials via OpenID Connect (OIDC) instead of long-lived static credentials. This is a security best practice.

    You may need to set your Google Cloud project explicitly:

    $ export GOOGLE_PROJECT="<YOUR_PROJECT_ID>"
    
    > $env:GOOGLE_PROJECT = "<YOUR_PROJECT_ID>"
    

    For detailed information on Pulumi’s use of Google Cloud credentials, see Google Cloud Setup.

      Neo just got smarter about infrastructure policy automation