[aws-lambda]: Resource-based policies get deleted when lambda RemovalPolicy set to RETAIN #28412
Labels
@aws-cdk/aws-lambda
Related to AWS Lambda
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
Hi team,
I meet a issue with deploying versioning lambda function with aws cdk. Even though we have lambda RemovalPolicy set to RETAIN, the resource-based policy of the lambda version get deleted after a update of the stack.
Here are the details:
I have a versioning lambda function created through aws cdk
In order to retain and able to invoke the old version lambda function when new lambda versions are created, I set the removal policy to retain through CDK.
And I add resource based policy for the lambda version in order to invoke my lambda function from another account:
However, when a stack update that generate a new lambda version of function, the resource based policy for the old lambda version get removed, only the old lambda version retained.
That cause the problem of not able to invoke old version of lambdas from another account
Expected Behavior
I expected the Resource-based policies of the version get retained
Current Behavior
Resource-based policies of the lambda version get deleted
Reproduction Steps
See above description
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
cdk2
Framework Version
No response
Node.js Version
18
OS
macOs
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: