由于 VPC 连接器注释,部署 Cloud Run 服务失败

时间:2021-02-08 09:10:55

标签: google-cloud-platform terraform google-cloud-run

今天部署新的云运行映像失败,错误如下:

ERROR: (gcloud.run.deploy) Annotation 'run.googleapis.com/vpc-access-connector' is not supported on resources of kind 'Service'. Supported kinds are: Revision, Job

这很奇怪,因为注释已经有一段时间没有更改了。

1 个答案:

答案 0 :(得分:3)

显然,gcp 停止在根服务元数据中支持该标签。如文档所述,标签应移至模板的元数据(请参阅 cloud run doc 中的 yaml 部分)。

地形代码:

resource "google_cloud_run_service" "gateway" {
  ... 
  template {
    metadata {
      annotations = {
        "run.googleapis.com/vpc-access-egress" : "all"
        "run.googleapis.com/vpc-access-connector": google_vpc_access_connector.connector.id
      }
    }
    spec {
      ...
    }
  }
  metadata {
    annotations = {
      "run.googleapis.com/launch-stage": "BETA"

      // I had the annotation here before
    }
  }
  ...
}

相关问题