简体   繁体   中英

gcp terraform - how to add pubsub_topic

I am quite new to GCP and 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).

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:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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