Closed rittneje closed 1 year ago
Still issue with CDK v2 i have some trouble with iam permissions as lambda layer name do not derivated from stack name. It hapen to me with BucketDeployment that use lambda layer inside
This is a duplicate of https://github.com/aws/aws-cdk/issues/8742, see additional info there.
This behavior is unfortunate, but I don't think CDK should add some custom behavior for Lambda Layers to paper over the issue. According to the Cloudformation documentation Logical IDs only need to be unique within a stack. So, using the same logical id in two different stacks should result in creating two resources (not both stacks updated the same resource).
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
@madeline-k This cannot be easily fixed at the CloudFormation level as it would be a breaking change. CDK is in a much better position as it can gate it behind a feature flag. This would not be the first time CDK has had to work around CloudFormation's idiosyncrasies. Please reopen this issue.
@rittneje I've opened a ticket internally with CloudFormation. If they are not able to address this, then I will re-open this issue and we can implement it in CDK with a feature flag.
(Internal ref: P80341878)
What is the problem?
If two different stacks both create a LayerVersion with the same logical id and no explicit name, they will both use the exact same Layer name, which is extremely confusing and unexpected.
Reproduction Steps
Deploy two stacks into the same region. In each, create an
aws_lambda.LayerVersion
with the same logical id, and do not explicitly specify alayer_version_name
.What did you expect to happen?
The layer names should be distinct, and derived from the stack name, as is the case for every other resource name CDK automatically calculates.
What actually happened?
They made different versions of the same layer.
CDK CLI Version
1.130.0 (build 9c094ae)
Framework Version
No response
Node.js Version
16.13.0
OS
Alpine 3.14
Language
Python
Language Version
3.9.7
Other information
No response