Similar to how we can already assign a Role or ResourceName to a Lambda function using the LambdaFunctionAttribute, we would like to be able to assign a Layer(s) to a Lambda function and also to have it update the CF template's serverless.template file.
Use Case
We have multiple stages that we deploy our Lambda functions to currently, and we have the ability to dynamically change the Role by using conditional build directives in C#, but only because the LambdaFunctionAttribute already exists. Unfortunately we have to manually edit the layer(s) for a given function directly in the serverless.template prior to deploying our Lambdas.
Proposed Solution
Ideally it would be implemented as an attribute, like the LambdaFunctionAttribute is done. If it would be more appropriate to add a Layers property to the existing LambdaFunctionAttribute, that would be acceptable too.
Other Information
The only alternative we've considered is using a PowerShell script to make the change for us when building the project.
Acknowledgements
[ ] I may be able to implement this feature request
Describe the feature
Similar to how we can already assign a Role or ResourceName to a Lambda function using the LambdaFunctionAttribute, we would like to be able to assign a Layer(s) to a Lambda function and also to have it update the CF template's serverless.template file.
Use Case
We have multiple stages that we deploy our Lambda functions to currently, and we have the ability to dynamically change the Role by using conditional build directives in C#, but only because the LambdaFunctionAttribute already exists. Unfortunately we have to manually edit the layer(s) for a given function directly in the serverless.template prior to deploying our Lambdas.
Proposed Solution
Ideally it would be implemented as an attribute, like the LambdaFunctionAttribute is done. If it would be more appropriate to add a Layers property to the existing LambdaFunctionAttribute, that would be acceptable too.
Other Information
The only alternative we've considered is using a PowerShell script to make the change for us when building the project.
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.Core 3.7.302.20, AWSSDK.Lambda 3.7.303.37
Targeted .NET Platform
.Net 6+
Operating System and version
Any