Search code examples
google-cloud-platformterraformdevopsterraform-provider-gcp

(Terraform, GCP) Error creating GlobalAddress: googleapi: Error 403: Required > 'compute.globalAddresses.create' permission for > 'projects/myproject-


I'm trying to reserve a global static external IP address on GCP with the Terraform code below:

provider "google" {
  credentials = file("myCredentials.json")
  project     = "myproject-638932"
  region      = "asia-northeast1"
}

resource "google_compute_global_address" "default" {
  name = "global-appserver-ip"
}

But I got this error:

Error creating GlobalAddress: googleapi: Error 403: Required 'compute.globalAddresses.create' permission for 'projects/myproject-638932/global/addresses/global-appserver-ip', forbidden

So now, I'm trying to add a role to solve this error above but there are too many roles to choose:

enter image description here

What role do I need to choose?


Solution

  • Choose the role "Compute Network Admin":

    enter image description here

    If you want to choose a more specific role, choose the role "Compute Public IP Admin":

    enter image description here

    Then, you can reserve a global static external IP address:

    enter image description here