Accept all Cloud Storage and Cloud Pub/Sub event types

This commit is contained in:
Riley Karson 2018-10-03 12:42:18 -07:00
parent 11129f13b8
commit e5d8575541
2 changed files with 7 additions and 7 deletions

View File

@ -593,10 +593,10 @@ func expandEventTrigger(configured []interface{}, project string) *cloudfunction
if data, ok := configured[0].(map[string]interface{}); ok {
eventType := data["event_type"].(string)
shape := ""
switch eventType {
case "providers/cloud.storage/eventTypes/object.change":
switch {
case strings.HasPrefix(eventType, "providers/cloud.storage/eventTypes/"):
shape = "projects/%s/buckets/%s"
case "providers/cloud.pubsub/eventTypes/topic.publish":
case strings.HasPrefix(eventType, "providers/cloud.pubsub/eventTypes/"):
shape = "projects/%s/topics/%s"
}

View File

@ -84,16 +84,16 @@ Deprecated. Use `event_trigger.failure_policy.retry` instead.
The `event_trigger` block supports:
* `event_type` - (Required) The type of event to observe. For example: `"providers/cloud.storage/eventTypes/object.change"`
and `"providers/cloud.pubsub/eventTypes/topic.publish"` Only `"providers/cloud.storage/eventTypes/object.change"` and
`"providers/cloud.pubsub/eventTypes/topic.publish"` are supported at this time.
and `"providers/cloud.pubsub/eventTypes/topic.publish"`. See the documentation on [calling Cloud Functions](https://cloud.google.com/functions/docs/calling/)
for a full reference. Only Cloud Storage and Cloud Pub/Sub triggers are supported at this time.
* `resource` - (Required) Required. The name of the resource from which to observe events, for example, `"myBucket"`
* `failure_policy` - (Required) Specifies policy for failed executions. Structure is documented below.
* `failure_policy` - (Optional) Specifies policy for failed executions. Structure is documented below.
The `failure_policy` block supports:
* `retry` - (Optional) Whether the function should be retried on failure. Defaults to `false`.
* `retry` - (Required) Whether the function should be retried on failure. Defaults to `false`.
## Attributes Reference