Terraform GCPt:值与主题名称中的正则表达式不匹配

问题描述 投票:0回答:1

我为警报创建了一个通知通道:

resource "google_monitoring_notification_channel" "slack_notification_channel" {
  display_name = "${var.project_name_prefix}-notification-channel"
  type         = "pubsub"
  labels = {
    topic = "${var.pubsub_topic_name}"
  }
}

公众和订户:

resource "google_pubsub_topic" "pubsub_topic" {
  name = "${var.pubsub_topic_name}"
}

resource "google_pubsub_subscription" "pubsub_subscription" {
  name  = "${var.project_name_prefix}-subscription"
  topic = "${var.pubsub_topic_name}"

  ack_deadline_seconds = 10

  push_config {
    push_endpoint = "${var.push_endpoint_link}"

    attributes = {
      x-goog-version = "v1"
    }
  }
}

主题名称:“ develop-alerts-topic”。 terraform输出的问题(手动创建主题很容易):

googleapi: Error 400: Field notification_channel.labels[topic] had an invalid value of "develop-alerts-topic": Value does not match the regular expression "projects/[^/]+/topics/[^/]+".

您能帮我理解为什么我得到一个错误的问题(但是创建了所有元素)吗?

google-cloud-platform publish-subscribe terraform-provider-gcp
1个回答
0
投票

您必须重复使用主题定义

© www.soinside.com 2019 - 2024. All rights reserved.