silvermine / serverless-plugin-cloudfront-lambda-edge

Adds Lambda@Edge support to Serverless
MIT License
296 stars 41 forks source link

Allow for CloudFormation references on pathPattern #48

Closed voodooGQ closed 3 years ago

voodooGQ commented 4 years ago

This addresses an issue I came across while developing for a Serverless framework project. I had Parameter values to centralize the pathPattern as it was being used in the Distribution as well as some custom cfn functionality. I was unable to utilize the intrinsic Ref function to associate that Parameter value with this plugin as the plugin is only designed for explicit strings in the pathParameter.

This {R makes the assumption that when an object is being passed in it is a Ref and should be treated like such, otherwise treat it as a normal string. This could potentially be expanded to include GetAtt values as well if the maintainer sees a potential advantage in that.

This is my first work on a Serverless type plugin, so if there are better ways to handle this I'm very happy to learn and adapt.

voodooGQ commented 4 years ago

@jthomerson I apologize just saw the information about opening an issue first. I'll get that added.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.5%) to 9.649% when pulling 510d778af7535ccd3deb3ac104a9de1b6c78b3d0 on voodooGQ:feature/path-reference into d2860cbc9e209a38d87d4fd96f56440356b9e3ca on silvermine:master.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.5%) to 9.649% when pulling 510d778af7535ccd3deb3ac104a9de1b6c78b3d0 on voodooGQ:feature/path-reference into d2860cbc9e209a38d87d4fd96f56440356b9e3ca on silvermine:master.

jthomerson commented 4 years ago

Could you provide a sample serverless.yml that uses this? Preferably something 100% deployable (zip with associated code is fine) so we can test with it.

voodooGQ commented 4 years ago

Sure thing @jthomerson. I'll get something together this morning.

voodooGQ commented 4 years ago

@jthomerson You can find a fully featured demo at https://github.com/voodooGQ/demo-serverless-plugin-cloudfront-lambda-edge. The code for this PR is included in the project so you should be able to just serverless deploy and see the behavior. Let me know if you have any questions.

voodooGQ commented 4 years ago

@jthomerson Any movement on this? Let me know if I can provide any additional information or assistance. Thank you!

jthomerson commented 4 years ago

Hey, sorry for the delay @voodooGQ! The repo helped a ton, so thanks! We can merge and cut a release after the requested changes are made.

voodooGQ commented 4 years ago

Sorry, got caught up with other items. I'll try and get this addressed early this week. Thank you!