【问题标题】:Health check for GCP Load balancer (from terraform)GCP 负载均衡器的运行状况检查(来自 terraform)
【发布时间】:2021-10-05 22:49:38
【问题描述】:

我正在尝试使用模块“gce-lb-http”为 Terraform 创建 GCP 基础架构,更准确地说,是负载平衡器。以下是错误:

╷
│ Error: Error creating HealthCheck: googleapi: Error 403: Required 
'compute.healthChecks.create' permission for 'projects/gcptf- 
320808/global/healthChecks/tf-createdlb-hc-default', forbidden 
│  
│   with module.gce-lb-http.google_compute_health_check.default["default"],
│   on .terraform/modules/gce-lb-http/main.tf line 203, in resource 
"google_compute_health_check" "default":
│  203: resource "google_compute_health_check" "default" {

所以我不知道为什么禁止创建健康检查?我怎样才能允许创建这个?

【问题讨论】:

  • 触发 Terraform 的用户(或服务帐户)需要此权限才能创建 HealthChecks 'compute.healthChecks.create'
  • 好点@Caiot,如果SA具有正确的权限,请检查文件中定义的项目ID,人们常犯的错误是使用项目名称而不是项目ID。另外,为了您在 Stackoverflow 上的安全,请隐藏您的项目 ID。
  • 我使用默认 SA 并授予负载平衡管理员角色(包含健康检查创建权限)。您可以在问题行中看到的项目 ID 是正确的

标签: google-cloud-platform terraform terraform-provider-gcp


【解决方案1】:

由 Terraform 触发的用户(或服务帐户)需要此权限才能创建 HealthChecks 'compute.healthChecks.create'。你

如果服务帐户具有正确的权限,请检查配置文件中定义的项目 ID,这是使用项目名称而不是项目 ID 的常见错误,或者只是拼写错误的 ID。

如果您需要某些特定权限,请查看说明如何add roles to a service account 和如何make custom roles 的文档。

您可能还会发现this question & answer 很有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-09
    • 2020-05-08
    • 2021-04-04
    • 1970-01-01
    • 1970-01-01
    • 2021-02-21
    • 2020-05-28
    • 2021-04-30
    相关资源
    最近更新 更多