-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(autoscaling): update validation on maxInstanceLifetime #19584
fix(autoscaling): update validation on maxInstanceLifetime #19584
Conversation
Originally, a lower bound of |
if (this.maxInstanceLifetime && | ||
(this.maxInstanceLifetime.toSeconds() < 604800 || this.maxInstanceLifetime.toSeconds() > 31536000)) { | ||
throw new Error('maxInstanceLifetime must be between 7 and 365 days (inclusive)'); | ||
(this.maxInstanceLifetime.toSeconds() !== 0) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to also check for this to be unresolved (!this.maxInstanceLifetime.isUnresolved()
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will update.
This patch fixes bugs in maxInstanceLifetime validation logic.
Changes since the first revision:
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
### Summary This patch fixes the following bugs in `maxInstanceLifetime` validation by aligning with [CFN doc](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-maxinstancelifetime): - A lower bound of `maxInstanceLifetime` is 1 day, not 7-days. - `maxInstanceLifetime` can have 0 which is used to clear a previously set value. ### Test - Run unit test. ``` PASS test/auto-scaling-group.test.js =============================== Coverage summary =============================== Statements : 93.11% ( 419/450 ) Branches : 86.93% ( 286/329 ) Functions : 91.81% ( 101/110 ) Lines : 92.84% ( 402/433 ) ================================================================================ ``` - Deploy CFN template having `maxInstanceLifetime` as 86,400 and 0. ### Notes Originally, this issue was reported by #12588. ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
### Summary This patch fixes the following bugs in `maxInstanceLifetime` validation by aligning with [CFN doc](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-maxinstancelifetime): - A lower bound of `maxInstanceLifetime` is 1 day, not 7-days. - `maxInstanceLifetime` can have 0 which is used to clear a previously set value. ### Test - Run unit test. ``` PASS test/auto-scaling-group.test.js =============================== Coverage summary =============================== Statements : 93.11% ( 419/450 ) Branches : 86.93% ( 286/329 ) Functions : 91.81% ( 101/110 ) Lines : 92.84% ( 402/433 ) ================================================================================ ``` - Deploy CFN template having `maxInstanceLifetime` as 86,400 and 0. ### Notes Originally, this issue was reported by aws#12588. ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Summary
This patch fixes the following bugs in
maxInstanceLifetime
validation by aligning with CFN doc:maxInstanceLifetime
is 1 day, not 7-days.maxInstanceLifetime
can have 0 which is used to clear a previously set value.Test
maxInstanceLifetime
as 86,400 and 0.Notes
Originally, this issue was reported by #12588.
All Submissions:
Adding new Unconventional Dependencies:
New Features
cdk-integ
to deploy the infrastructure and generate the snapshot (i.e.cdk-integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license