Skip to content

Commit 9155a55

Browse files
ssaquanat-henderson
authored andcommitted
Update to Cloud Functions Pub/Sub trigger event (#1180)
1 parent 7e64b3f commit 9155a55

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

google/resource_cloudfunctions_function.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func resourceCloudFunctionsCreate(d *schema.ResourceData, meta interface{}) erro
267267
// Make PubSub event publish as in https://cloud.google.com/functions/docs/calling/pubsub
268268
function.EventTrigger = &cloudfunctions.EventTrigger{
269269
// Other events are not supported
270-
EventType: "providers/cloud.pubsub/eventTypes/topic.publish",
270+
EventType: "google.pubsub.topic.publish",
271271
// Must be like projects/PROJECT_ID/topics/NAME
272272
// Topic must be in same project as function
273273
Resource: fmt.Sprintf("projects/%s/topics/%s", project, v.(string)),
@@ -350,7 +350,7 @@ func resourceCloudFunctionsRead(d *schema.ResourceData, meta interface{}) error
350350
if function.EventTrigger != nil {
351351
switch function.EventTrigger.EventType {
352352
// From https://github.com/google/google-api-go-client/blob/master/cloudfunctions/v1/cloudfunctions-gen.go#L335
353-
case "providers/cloud.pubsub/eventTypes/topic.publish":
353+
case "google.pubsub.topic.publish":
354354
d.Set("trigger_topic", GetResourceNameFromSelfLink(function.EventTrigger.Resource))
355355
case "providers/cloud.storage/eventTypes/object.change":
356356
d.Set("trigger_bucket", GetResourceNameFromSelfLink(function.EventTrigger.Resource))

google/resource_cloudfunctions_function_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ func testAccCloudFunctionsFunctionTrigger(n int, function *cloudfunctions.CloudF
296296
if function.EventTrigger == nil {
297297
return fmt.Errorf("Expected EventTrigger to be set")
298298
}
299-
if strings.Index(function.EventTrigger.EventType, "cloud.pubsub") == -1 {
300-
return fmt.Errorf("Expected cloud.pubsub EventType, found %s", function.EventTrigger.EventType)
299+
if strings.Index(function.EventTrigger.EventType, "google.pubsub") == -1 {
300+
return fmt.Errorf("Expected google.pubsub EventType, found %s", function.EventTrigger.EventType)
301301
}
302302
default:
303303
return fmt.Errorf("testAccCloudFunctionsFunctionTrigger expects only FUNCTION_TRIGGER_HTTP, " +

0 commit comments

Comments
 (0)