小编Pri*_*tel的帖子

trigger_topic 不适用于 terraform 资源 google_cloudfunctions_function

我为 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)

terraform google-cloud-functions

4
推荐指数
1
解决办法
2944
查看次数

标签 统计

google-cloud-functions ×1

terraform ×1