由于 VPC 连接器注释,部署云 运行 服务失败

Deploying Cloud Run Service fails because of VPC Connector annotation

今天部署新云 运行 映像失败,出现以下错误:

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

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

显然,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
    }
  }
  ...
}