Skip to content

Commit e5d8575

Browse files
committed
Accept all Cloud Storage and Cloud Pub/Sub event types
1 parent 11129f1 commit e5d8575

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

google/resource_cloudfunctions_function.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,10 @@ func expandEventTrigger(configured []interface{}, project string) *cloudfunction
593593
if data, ok := configured[0].(map[string]interface{}); ok {
594594
eventType := data["event_type"].(string)
595595
shape := ""
596-
switch eventType {
597-
case "providers/cloud.storage/eventTypes/object.change":
596+
switch {
597+
case strings.HasPrefix(eventType, "providers/cloud.storage/eventTypes/"):
598598
shape = "projects/%s/buckets/%s"
599-
case "providers/cloud.pubsub/eventTypes/topic.publish":
599+
case strings.HasPrefix(eventType, "providers/cloud.pubsub/eventTypes/"):
600600
shape = "projects/%s/topics/%s"
601601
}
602602

website/docs/r/cloudfunctions_function.html.markdown

+4-4
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,16 @@ Deprecated. Use `event_trigger.failure_policy.retry` instead.
8484
The `event_trigger` block supports:
8585

8686
* `event_type` - (Required) The type of event to observe. For example: `"providers/cloud.storage/eventTypes/object.change"`
87-
and `"providers/cloud.pubsub/eventTypes/topic.publish"` Only `"providers/cloud.storage/eventTypes/object.change"` and
88-
`"providers/cloud.pubsub/eventTypes/topic.publish"` are supported at this time.
87+
and `"providers/cloud.pubsub/eventTypes/topic.publish"`. See the documentation on [calling Cloud Functions](https://cloud.google.com/functions/docs/calling/)
88+
for a full reference. Only Cloud Storage and Cloud Pub/Sub triggers are supported at this time.
8989

9090
* `resource` - (Required) Required. The name of the resource from which to observe events, for example, `"myBucket"`
9191

92-
* `failure_policy` - (Required) Specifies policy for failed executions. Structure is documented below.
92+
* `failure_policy` - (Optional) Specifies policy for failed executions. Structure is documented below.
9393

9494
The `failure_policy` block supports:
9595

96-
* `retry` - (Optional) Whether the function should be retried on failure. Defaults to `false`.
96+
* `retry` - (Required) Whether the function should be retried on failure. Defaults to `false`.
9797

9898
## Attributes Reference
9999

0 commit comments

Comments
 (0)