-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Cloud Function trigger_event yields a 400 Bad Request #2409
Comments
I debugged this further, and the problem yielding the The problem was that I used the event type as described in the Google documentation (that you link to from the Terraform docs):
But in order to get the string interpolation to work, we have to define the type using another notation:
After making that change, the resource is named correctly in the request, but I still get a 400 bad request. However, if I change the
Curiously enough, |
I think I see what's happening here! We only supported the legacy triggers before, and I added support for a more correct syntax but didn't expand the number of triggers we support (since it isn't a breaking change to do so in the future and was constrained by time so we could cut To my understanding, the syntax has changed for declaring a trigger from a shape like You're correct that the reference documentation isn't a great fit there - neither is the reference for the field itself, which explains how to shape a legacy request (I think the format you send in a request has changed. I'll verify that as I implement this.) I'll look into making the Terraform documentation a little clearer, and supporting new-style Cloud Storage triggers right now. |
Great! Thank you very much for looking into it, and keep up the great work! :-) |
@rileykarson provider/terraform/website/docs/d/datasource_cloudfunctions_function.html.markdown remains unchanged, which leads to an outdated documentation |
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! |
Spun out #4171 for the docs issue. |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/hedlund/805f28874274090af63fc897cd604229
Expected Behavior
Terraform should've created a cloud function with a Cloud Storage event trigger.
Actual Behavior
I get a 400 bad request.
Steps to Reproduce
If I do not include the
event_trigger
everything works fine, but I can not get it to work with the trigger.Looking into the debug logs (linked above) og the actual JSON request, we can see that the
resource
field on theeventTrigger
object gets mangled:That should just be a plain resource name. Seeing as the code in the provider uses a function called
GetResourceNameFromSelfLink
, I have tried using aself_link
reference to a bucket resource, as well as various combinations of string names, but nothing works.The
%!(EXTRA
field hint that we have some variadic string interpolation that doesn't work as intended.The text was updated successfully, but these errors were encountered: