如何在地形中为GCS创建事件弧触发器?



我想为GCS对象创建一个eventarc触发器。根据Eventarc文档,这应该使用直接GCS触发器。我可以这样创建它,但是我不知道把桶名放在哪里:

resource "google_eventarc_trigger" "upload" {
name     = "upload"
location = "europe-west1"
matching_criteria {
attribute = "type"
value     = "google.cloud.storage.object.v1.finalized"
}
destination {
workflow = google_workflows_workflow.process_file.id
}
service_account = google_service_account.workflow.email
}

当我运行这个例子时,我得到以下错误:

Error: Error creating Trigger: googleapi: Error 400: The request was invalid: The request was invalid: missing required attribute "bucket" in trigger.event_filters

阅读文档没有帮助,但在阅读了使用Terraform创建Eventarc触发器之后我在博客上多次找到了答案。bucket可以作为matching_criteria的另一个块,如下所示:

resource "google_eventarc_trigger" "upload" {
name     = "upload"
location = "europe-west1"
matching_criteria {
attribute = "type"
value     = "google.cloud.storage.object.v1.finalized"
}
matching_criteria {
attribute = "bucket"
value     = google_storage_bucket.uploads.name
}
destination {
workflow = google_workflows_workflow.process_file.id
}
service_account = google_service_account.workflow.email
}

相关内容

  • 没有找到相关文章

最新更新