我为 terraform 定义了以下资源来创建云函数。我希望能够通过 pubsub 消息触发它。
我该使用哪一个块?event_trigger或trigger_topic
resource "google_cloudfunctions_function" "function" {
name = var.appname
entry_point = "entry"
available_memory_mb = 128
timeout = 120
project = var.gcpproject
region = var.region
#trigger_topic = "projects/${var.gcpproject}/topics/cloud-builds-topic"**
source_archive_bucket = var.google_storage_bucket
source_archive_object = "code/${var.appname}.zip"
runtime = "python3.7"
#event_trigger = {
# event_type= "google.pubsub.topic.publish"
# resource= "projects/${var.gcpproject}/topics/cloud-builds-topic"
# service= "pubsub.googleapis.com"
# failure_policy= {}
# }
}
Run Code Online (Sandbox Code Playgroud)
当我使用trigger_topic时,出现错误
Error: Unsupported argument
on main.tf line 12, in resource "google_cloudfunctions_function" "function":
12: trigger_topic = "projects/${var.gcpproject}/topics/cloud-builds-topic"
An argument named "trigger_topic" is not …Run Code Online (Sandbox Code Playgroud)