由于 VPC Connector 注释,部署 Cloud Run Service 失败

gdo*_*lar 5 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
Run Code Online (Sandbox Code Playgroud)

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

gdo*_*lar 12

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

Run Code Online (Sandbox Code Playgroud)