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

(@aws-cdk/aws-lambda): add an object version parameter to CfnParametersCode #8702

Closed
1 of 2 tasks
alexnikolis opened this issue Jun 23, 2020 · 2 comments
Closed
1 of 2 tasks
Labels
@aws-cdk/aws-lambda Related to AWS Lambda closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@alexnikolis
Copy link

The CfnParametersCode class currently adds a bucketName and objectKey parameter to the stack. I would like to add objectVersion as well.

Use Case

I am concerned about a scenario where a hotfix needs to be made to the CloudFormation template that should not include an update to the Function's code, but the s3 code archive has been update separately.

Since the object version has not been pinned, I believe this would result in a new version being created and an unintentional update of the lambda's code.

Proposed Solution

A rough implementation was discussed in the original PR:
#2027 (comment)

Essentially just add the objectVersion parameter following the same convention as the bucket and key parameters.

Other

The existing CfnParametersCode implementation:
https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/aws-lambda/lib/code.ts#L248

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

This is a 🚀 Feature Request

@alexnikolis alexnikolis added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jun 23, 2020
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Jun 23, 2020
@nija-at nija-at added effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jun 26, 2020
@alexnikolis
Copy link
Author

Another thought I had on this - fn.currentVersion is currently only supported for functions that use lambda.Code.fromAsset or lambda.Code.fromInline. This is problematic since addVersion is depreciated now, so continuous deployment for a Function using external Code seems to require using the latestVersion property, which has a number of disadvantages.

I believe an object version could be used to automatically generate a new lambda version for currentVersion.

https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-readme.html#versions-and-aliases
https://docs.aws.amazon.com/cdk/latest/guide/codepipeline_example.html#codepipeline_example_lambda

@github-actions
Copy link

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants