Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse Logical IDs of existing serverless framework resources for the L2 Constructs #32957

Open
2 tasks
Waqiah opened this issue Jan 15, 2025 · 1 comment
Open
2 tasks
Labels
@aws-cdk/aws-s3 Related to Amazon S3 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@Waqiah
Copy link

Waqiah commented Jan 15, 2025

Describe the feature

Hoping to prevent CFN from creating a resource that an existing serverless framework stack had already created allowing us to reuse the Logical IDs for new L2 Constructs. This prevents the deletion of the stacks created by Serverless Framework (preventing data loss etc) and prevents CDK having to recreate these stacks.

Use Case

Currently CFN has an issue with the Logical IDs that AWS CDK is generating (the adding of a "8-digit hash"). Allowing CDK to recreate the stacks do work but trying to avoid that as it would be preferred to NOT delete each stack created by Serverless Framework since some stacks create S3 buckets and DynamoDB tables which have data.

Instead, looking for a way to use L2 constructs, similar to what is happening in the below link but without relying on the template JSON file as I am looking to reuse the existing logical ids for new L2 constructs natively:
https://docs.aws.amazon.com/cdk/v1/guide/use_cfn_template.html

Proposed Solution

It is noted that for a workaround I can use an excape hatch to access the node default child in order to interfact with its L1 interface, then use the L1 method overrideLogicalId to change the logical ID, but putting in this feature request for a more native way of being able to reuse the logical IDs.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

v2.175.0

Environment details (OS name and version, etc.)

n/a

@Waqiah Waqiah added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 15, 2025
@github-actions github-actions bot added the @aws-cdk/aws-s3 Related to Amazon S3 label Jan 15, 2025
@pahud pahud self-assigned this Jan 16, 2025
@pahud
Copy link
Contributor

pahud commented Jan 16, 2025

Hi

Based on the description above, the FR is trying to achieve the following:

  1. Prevent AWS CloudFormation (CFN) from creating a resource that an existing Serverless Framework stack had already created.

  2. Reuse the existing Logical IDs of the resources created by the Serverless Framework stack for new AWS CDK L2 Constructs.

This would allow users to:

  • Avoid deleting the existing Serverless Framework stacks, which may have created S3 buckets, DynamoDB tables, etc. with data that they want to preserve.

  • Prevent AWS CDK from having to recreate those existing resources and generate new Logical IDs (which adds a 8-digit hash by default).

This sound like a "inter-changeable" way between Serverless Framework and CDK that when Serverless Framework deploys the stack, CDK could natively use that from the L2 constructs without L1 logical ID override. Is this correct?

This seems an interesting idea and we welcome more discussion here. Please help us prioritize with 👍

@pahud pahud added the p2 label Jan 16, 2025
@pahud pahud removed their assignment Jan 16, 2025
@pahud pahud added effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-s3 Related to Amazon S3 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants