mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-01 16:21:06 +00:00
Add support for new-style cloud functions triggers. (#2412)
<!-- This change is generated by MagicModules. --> /cc @rileykarson
This commit is contained in:
parent
f745e5f178
commit
b8e74f0676
@ -526,6 +526,11 @@ func expandEventTrigger(configured []interface{}, project string) *cloudfunction
|
|||||||
eventType := data["event_type"].(string)
|
eventType := data["event_type"].(string)
|
||||||
shape := ""
|
shape := ""
|
||||||
switch {
|
switch {
|
||||||
|
case strings.HasPrefix(eventType, "google.storage.object."):
|
||||||
|
shape = "projects/%s/buckets/%s"
|
||||||
|
case strings.HasPrefix(eventType, "google.pubsub.topic."):
|
||||||
|
shape = "projects/%s/topics/%s"
|
||||||
|
// Legacy style triggers
|
||||||
case strings.HasPrefix(eventType, "providers/cloud.storage/eventTypes/"):
|
case strings.HasPrefix(eventType, "providers/cloud.storage/eventTypes/"):
|
||||||
shape = "projects/%s/buckets/%s"
|
shape = "projects/%s/buckets/%s"
|
||||||
case strings.HasPrefix(eventType, "providers/cloud.pubsub/eventTypes/"):
|
case strings.HasPrefix(eventType, "providers/cloud.pubsub/eventTypes/"):
|
||||||
|
@ -473,7 +473,7 @@ resource "google_cloudfunctions_function" "function" {
|
|||||||
timeout = 61
|
timeout = 61
|
||||||
entry_point = "helloGCS"
|
entry_point = "helloGCS"
|
||||||
event_trigger {
|
event_trigger {
|
||||||
event_type = "providers/cloud.storage/eventTypes/object.change"
|
event_type = "google.storage.object.finalize"
|
||||||
resource = "${google_storage_bucket.bucket.name}"
|
resource = "${google_storage_bucket.bucket.name}"
|
||||||
failure_policy {
|
failure_policy {
|
||||||
retry = true
|
retry = true
|
||||||
@ -503,7 +503,7 @@ resource "google_cloudfunctions_function" "function" {
|
|||||||
timeout = 61
|
timeout = 61
|
||||||
entry_point = "helloGCS"
|
entry_point = "helloGCS"
|
||||||
event_trigger {
|
event_trigger {
|
||||||
event_type = "providers/cloud.storage/eventTypes/object.change"
|
event_type = "google.storage.object.finalize"
|
||||||
resource = "${google_storage_bucket.bucket.name}"
|
resource = "${google_storage_bucket.bucket.name}"
|
||||||
}
|
}
|
||||||
}`, bucketName, zipFilePath, functionName)
|
}`, bucketName, zipFilePath, functionName)
|
||||||
|
@ -76,9 +76,11 @@ The following arguments are supported:
|
|||||||
|
|
||||||
The `event_trigger` block supports:
|
The `event_trigger` block supports:
|
||||||
|
|
||||||
* `event_type` - (Required) The type of event to observe. For example: `"providers/cloud.storage/eventTypes/object.change"`
|
* `event_type` - (Required) The type of event to observe. For example: `"google.storage.object.finalize"`.
|
||||||
and `"providers/cloud.pubsub/eventTypes/topic.publish"`. See the documentation on [calling Cloud Functions](https://cloud.google.com/functions/docs/calling/)
|
See the documentation on [calling Cloud Functions](https://cloud.google.com/functions/docs/calling/) for a full reference.
|
||||||
for a full reference. Only Cloud Storage and Cloud Pub/Sub triggers are supported at this time.
|
Only Cloud Storage and Cloud Pub/Sub triggers are supported at this time.
|
||||||
|
Legacy Cloud Storage and Cloud Pub/Sub triggers are also supported, such as `"providers/cloud.storage/eventTypes/object.change"`
|
||||||
|
and `"providers/cloud.pubsub/eventTypes/topic.publish"`.
|
||||||
|
|
||||||
* `resource` - (Required) Required. The name of the resource from which to observe events, for example, `"myBucket"`
|
* `resource` - (Required) Required. The name of the resource from which to observe events, for example, `"myBucket"`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user