Skip to content

Latest commit

 

History

History
107 lines (74 loc) · 3.33 KB

File metadata and controls

107 lines (74 loc) · 3.33 KB

GCP and Terraform on Windows

You don't need these instructions if you use WSL. It's only for "plain Windows"

Google Cloud SDK

When installing it, you might see something like that:

The installer is unable to automatically update your system PATH. Please add
  C:\tools\google-cloud-sdk\bin

Now we need to point it to correct Python installation. Assuming you use Anaconda:

export CLOUDSDK_PYTHON=~/Anaconda3/python

Now let's check that it works:

$ gcloud version
Google Cloud SDK 367.0.0
bq 2.0.72
core 2021.12.10
gsutil 5.5

Google Cloud SDK Authentication

  • Now create a service account and generate keys like shown in the videos
  • Download the key and put it to some location, e.g. .gc/ny-rides.json
  • Set GOOGLE_APPLICATION_CREDENTIALS to point to the file
export GOOGLE_APPLICATION_CREDENTIALS=~/.gc/ny-rides.json

Now authenticate:

gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS

Alternatively, you can authenticate using OAuth like shown in the video

gcloud auth application-default login

If you get a message like quota exceeded

WARNING: Cannot find a quota project to add to ADC. You might receive a "quota exceeded" or "API not enabled" error. Run $ gcloud auth application-default set-quota-project to add a quota project.

Then run this:

PROJECT_NAME="ny-rides-alexey"
gcloud auth application-default set-quota-project ${PROJECT_NAME}

Terraform

terraform init

Optionally you can configure your terraform files (variables.tf) to include your project id:

variable "project" {
  description = "Your GCP Project ID"
  default = "ny-rides-alexey"
  type = string
}

If you get an error like that:

Error: googleapi: Error 403: [email protected] does not have storage.buckets.create access to the Google Cloud project., forbidden

Then you need to give your service account all the permissions. Make sure you follow the instructions in the videos

  • You can also use this file, but it doesn't list all the required permissions