Retain option for Lambda@Edge functions? #930
Description
Is your feature request related to a problem? Please describe.
Currently, due to edge function limitations there is no way to delete a sls-next stack without it failing for 2hrs before the replicas are deleted.
Describe the solution you'd like
Perhaps providing a "retain" option would allow people to quickly/safely delete the stack minus the functions, and then people could implement their own orphan function cleanup crons.
Describe alternatives you've considered
Until AWS closes this issue, it's likely always going to be one of two solutions:
A) let the stack delete FAIL then setup a cron to delete the stack 2hrs later.
or
B) set the edge functions to retain, letting all stack deletes SUCCEED, and then use a cron to clean up those orphan functions 2 hrs later.
Option B: seems the most accurate and least disruptive to existing pipelines.
Other thoughts / Options
The other potential option here for this project is to find a way to "reuse" the same edge functions. (default + images)
Images Function
right now it looks like the only unique files in the images is the manifest. If that could be moved out of the function and into an S3 storage to be loaded in and cached then one would only need a single image function for all stacks/sites.
Default Function
This one is more tricky since it contains literally the JS files that are to be used for SSR. It likely is still and option to store these outside of the function and load them in.... but not sure what the performance hit might be.