terraform-google-modules / cloud-foundation-training

https://registry.terraform.io/modules/terraform-google-modules/cloud-foundation-training/google
Apache License 2.0
98 stars 91 forks source link

Add SA binding for role with compute.zones.list #41

Closed stevewww closed 3 years ago

stevewww commented 3 years ago

Error on executing terraform plan for labs 04 and 05:

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.local_file.instance_startup_script: Refreshing state...
module.instance_template.data.google_compute_image.image_family: Refreshing state...
module.managed_instance_group.data.google_compute_zones.available: Refreshing state...
module.instance_template.data.google_compute_image.image: Refreshing state...

Error: googleapi: Error 403: Required 'compute.zones.list' permission for 'projects/welham-cft', forbidden

  on .terraform/modules/managed_instance_group/modules/mig/main.tf line 31, in data "google_compute_zones" "available":
  31: data "google_compute_zones" "available" {

Fixed with change to 00-setup:

gcloud projects add-iam-policy-binding ${PROJECT_ID} --member="serviceAccount:${SERVICE_ACCOUNT}" --role="roles/compute.viewer"

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days