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

(Hotswap): CDK v2 Hotswapping support for SAM.CfnFunction #20021

Open
2 tasks
KingOfPoptart opened this issue Apr 21, 2022 · 2 comments
Open
2 tasks

(Hotswap): CDK v2 Hotswapping support for SAM.CfnFunction #20021

KingOfPoptart opened this issue Apr 21, 2022 · 2 comments
Labels
effort/medium Medium work item – several days of effort feature/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. feature-request A feature should be added or improved. hotswap p3 package/tools Related to AWS CDK Tools or CLI

Comments

@KingOfPoptart
Copy link
Contributor

Describe the feature

Currently it looks like the only way hotswap will support a lambda is if it is of resource type AWS::Lambda::Function -

if (newResourceType !== 'AWS::Lambda::Function') {

Use Case

We currently use SAM.CfnFunction since it gets us gradual deployments of our lambdas.

We don't want to lose our ability to do gradual deployments with lambda,. As such we're stuck choosing between hot swapping or gradual deployments in the current state of CDK v2.

Proposed Solution

Add support for AWS::Serverless::Function for hot swapping.

Other Information

No response

Acknowledgements

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

CDK version used

2.20.0

Environment details (OS name and version, etc.)

MacOS 12.3.1

@KingOfPoptart KingOfPoptart added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Apr 21, 2022
@github-actions github-actions bot added the aws-cdk-lib Related to the aws-cdk-lib package label Apr 21, 2022
@KingOfPoptart
Copy link
Contributor Author

I spoke with Rico briefly, and this might be a "not possible"

"Why hotswapping won't work: we can't look into the transform, and so we don't know what a SAM::Function turns into, so we can't call UpdateFunction for you"

I'll leave it open in case anybody else has any clever ideas.

@skinny85
Copy link
Contributor

skinny85 commented Apr 22, 2022

I actually think it could be doable, because the logical ID of AWS::Serverless::Function will be the same for the AWS::Lambda::Function generated after the transform has executed. You can verify that by using the "View processed template" in the CloudFormation AWS Console in the "Template" tab of a Stack view for any Stack that uses the Serverless transform. And if we have the logical ID, we can get the Lambda's physical name from the CloudFormation API (ListStackResources).

@skinny85 skinny85 added p2 package/tools Related to AWS CDK Tools or CLI effort/medium Medium work item – several days of effort feature/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. and removed needs-triage This issue or PR still needs to be triaged. aws-cdk-lib Related to the aws-cdk-lib package labels Apr 22, 2022
@khushail khushail changed the title CDK v2 Hotswapping support for SAM.CfnFunction (Hotswap): CDK v2 Hotswapping support for SAM.CfnFunction Jun 5, 2024
@pahud pahud added p3 and removed p2 labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/medium Medium work item – several days of effort feature/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. feature-request A feature should be added or improved. hotswap p3 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

5 participants