Skip to content

Conversation

mzakarim
Copy link

@mzakarim mzakarim commented Nov 8, 2021

Add possibility to add layers as list of string in plugin configuration

@claygregory
Copy link
Owner

Hi @mzakarim,

Before we proceed too far, please help me understand the use-case for this functionality. If we allow configuration to target specific layers in automatic pruning, we should likely do the same for functions as well for parity. But first, I want to make sure we're not building for an edge case.

As designed, automatic is just a shortcut feature for the common task of prune-all-the-things on deploy. Targeted pruning may be best handled by scripted sls prune -function <target> or sls prune -layer <target> within your CI/CD pipeline. But I'm willing to be wrong about this if given an interesting use-case! :)

@mzakarim
Copy link
Author

mzakarim commented Nov 9, 2021

Hi @claygregory,

Thanks for your response.

I use serverless-layers to define my layers.

According to my understanding, prune assumed that layers are defined inside layers key in serverless configuration. However, with serverless-layers plugin, layers are defined inside serverless-layers so the method getAllLayers return empty list.

Specifying the layers in the custom configuration allows to directly give the list to prune plugin if the layers are defined other than by using the default method.

@claygregory
Copy link
Owner

Thanks for the clarification @mzakarim. In my opinion, plugins that create additional resources, as serverless-layers, are best positioned to manage the full lifecycle of those resources.

My goal is to keep the prune plugin relatively pure in purpose, so it "just works." Allowing plugin configuration to target resources beyond those directly Framework-managed opens the door to then supporting resources outside the stack entirely. And supporting all the desired patterns of when it is/is not suitable to prune those additional resources.

That said, I appreciate hearing the various needs that users like you have. I'm open to revisiting this at a later time if sufficient feedback demands it, but for now I'd like to put this feature on ice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants