简体   繁体   English

gcp terraform - 如何添加 pubsub_topic

[英]gcp terraform - how to add pubsub_topic

I am quite new to GCP and terraform.我对 GCP 和 terraform 很陌生。 I am trying to create pubsub_topic with terraform in Google Cloud and link it with budget, so budget will use the topic as a link with cloud function (passing notifications).我正在尝试在 Google Cloud 中使用 terraform 创建 pubsub_topic 并将其与预算链接,因此预算将使用该主题作为与云 function 的链接(传递通知)。

I am stuck at creating the topic.我被困在创建主题上。

resource "google_pubsub_topic" "topic" {
  name    = alert_topic
  project = my_project
}

resource "google_billing_budget" "global-budget" {
  provider        = google-beta
  billing_account = var.billing_account_id
  display_name    = "Global Billing Budget"

  amount {
    specified_amount {
      currency_code = "EUR"
      units         = "500"
    }
  }

  threshold_rules {
    threshold_percent = 0.5
  }

  all_updates_rule {
    pubsub_topic = projects / my_project / topics / alert_topic
  }
}

terraform plan command results: terraform plan命令结果:

A reference to a resource type must be followed by at least one
attribute access, specifying the resource name.

What I do wrong?我做错了什么?

terraform version
Terraform v0.12.23
+ provider.google v3.13.0
+ provider.google-beta v3.13.0

pubsub_topic required quotes pubsub_topic 必填引号

all_updates_rule {
    pubsub_topic = "projects/my_project/topics/alert_topic"
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM