(Terraform,GCP)错误 403:拒绝列出消费者容器服务的权限 [projects/335478934851]

(Terraform, GCP) Error 403: Permission denied to list services for consumer container [projects/335478934851]

GCP 上,我正在尝试启用 “身份和访问管理 (IAM) API” Terraform 代码如下:

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

resource "google_project_service" "project" {
  service = "iam.googleapis.com"
}

但是我得到了这个错误:

Error when reading or editing Project Service : Request List Project Services myproject-173831 returned error: Failed to list enabled services for project myproject-173831: googleapi: Error 403: Permission denied to list services for consumer container [projects/335478934851]

然后,我无法启用它

所以现在,我正在尝试添加一个角色来解决上面的这个错误,但是角色太多无法选择:

我需要选择什么角色?

选择角色“配额管理员”:

然后,再次应用您的 Terraform 代码:

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

resource "google_project_service" "project" {
  service = "iam.googleapis.com"
}

最后,您可以启用 “身份和访问管理 (IAM) API”: