Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Cloud Functions Pub/Sub trigger event #1180

Merged
merged 2 commits into from
Mar 12, 2018
Merged

Update to Cloud Functions Pub/Sub trigger event #1180

merged 2 commits into from
Mar 12, 2018

Conversation

ssaqua
Copy link
Contributor

@ssaqua ssaqua commented Mar 11, 2018

The current providers/cloud.pubsub/eventTypes/topic.publish trigger event is marked as a legacy event type. There is no issue using it at the moment but is stated that it could be removed at a future date.

https://cloud.google.com/functions/docs/calling/pubsub#legacy_cloud_pubsub_triggers

There are some changes to the event object format that comes through on Pub/Sub messages. Although this doesn't matter for terraform, one thing to note is that functions that have been deployed using the legacy event type (before Feb 28) need to be deleted and redeployed in order to support the new event type. Any new deployments that occur after Feb 28 will use the new event type.

I've created an issue separately for updates to Cloud Storage event triggers: #1179

Here are some snippets from a GCP email I received highlighting these changes:

Google Cloud Pub/Sub event format
Google Cloud Pub/Sub events will move to a new format to better and more logically organize related attributes. Specifically, all metadata such as [eventId] and [timestamp] will be moved exclusively into the context property of the event parameter. See our documentation on how to use the new events. After February 28, 2018, deploying a new function with the 'gcloud beta functions deploy --trigger-topic' command will cause it to receive this new format.

What happens to my running functions?
Your running functions will not be affected by either of these changes at this time. They will continue to receive events as usual and with the current schema. These older, legacy event types, however, are no longer being actively supported and will remain in beta indefinitely.

What if I want to update one of my functions that is using a legacy event type?
After February 28, 2018, attempting to update a function that is using a legacy event type via the --trigger-bucket or --trigger-topic flag in gcloud will not succeed. If you want to update one of your existing functions, we have preserved the legacy Cloud Storage and legacy Pub/Sub events. These will allow you to continue to maintain your code even after the gcloud SDK behavior is changed to take advantage of the new Cloud Storage and Cloud Pub/Sub events.

@nat-henderson nat-henderson self-requested a review March 12, 2018 20:27
Copy link
Contributor

@nat-henderson nat-henderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - running the tests now.

@nat-henderson
Copy link
Contributor

Ah, bummer, looks like the pubsub test doesn't pass:

------- Stdout: -------
=== RUN   TestAccCloudFunctionsFunction_pubsub
--- FAIL: TestAccCloudFunctionsFunction_pubsub (27.56s)
    testing.go:513: Step 0 error: Check failed: Check 4/7 error: Expected cloud.pubsub EventType, found google.pubsub.topic.publish
FAIL

Can you fix that up?

Copy link
Contributor

@nat-henderson nat-henderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mergeable once tests pass.

@nat-henderson
Copy link
Contributor

Re-running tests.

@nat-henderson
Copy link
Contributor

Tests look good! Waiting on Travis now.

@nat-henderson nat-henderson merged commit 9155a55 into hashicorp:master Mar 12, 2018
@ssaqua ssaqua deleted the cloud-functions branch March 12, 2018 22:03
ashish-amarnath pushed a commit to ashish-amarnath/terraform-provider-google that referenced this pull request Mar 20, 2018
@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants