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

fix(rds): fail with a descriptive error if Cluster's instance count is a deploy-time value #13765

Merged
merged 5 commits into from
Mar 26, 2021

Conversation

BLasan
Copy link
Contributor

@BLasan BLasan commented Mar 24, 2021

Added a condition to check whether the instanceCount is a token or not. If it's not a token then an exception will be thrown.

Fixes #13558


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Mar 24, 2021

@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label Mar 24, 2021
@BLasan
Copy link
Contributor Author

BLasan commented Mar 24, 2021

@skinny85 Please review

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @BLasan!

You're missing an unit test for the fix though 🙂.

@@ -651,6 +651,9 @@ interface InstanceConfig {
*/
function createInstances(cluster: DatabaseClusterNew, props: DatabaseClusterBaseProps, subnetGroup: ISubnetGroup): InstanceConfig {
const instanceCount = props.instances != null ? props.instances : 2;
if (Token.isUnresolved(instanceCount)) {
throw new Error('Instance count is not a token');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message needs to be better here. Maybe something like:

Suggested change
throw new Error('Instance count is not a token');
throw new Error('The number of instances an RDS Cluster consists of cannot be provided as a deploy-time only value!');

@skinny85 skinny85 changed the title chore(aws-rds): add checking instanceCount is a token or not fix(rds): fail with a descriptive error if Cluster's instance count is a deploy-time value Mar 24, 2021
@mergify mergify bot dismissed skinny85’s stale review March 25, 2021 06:53

Pull request has been modified.

@BLasan
Copy link
Contributor Author

BLasan commented Mar 25, 2021

@skinny85 Made the requested changes. Please review

skinny85
skinny85 previously approved these changes Mar 26, 2021
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @BLasan , thanks for the contribution!

@BLasan
Copy link
Contributor Author

BLasan commented Mar 26, 2021

@skinny85 Build fails

@mergify mergify bot dismissed skinny85’s stale review March 26, 2021 02:47

Pull request has been modified.

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This time should do it 😉

@BLasan
Copy link
Contributor Author

BLasan commented Mar 26, 2021

This time should do it wink

thanks :)

@mergify
Copy link
Contributor

mergify bot commented Mar 26, 2021

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: c712aea
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Mar 26, 2021

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).

@mergify mergify bot merged commit dd22e8f into aws:master Mar 26, 2021
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Mar 31, 2021
…s a deploy-time value (aws#13765)

Added a condition to check whether the `instanceCount` is a token or not. If it's not a token then an exception will be thrown.

Fixes aws#13558 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…s a deploy-time value (aws#13765)

Added a condition to check whether the `instanceCount` is a token or not. If it's not a token then an exception will be thrown.

Fixes aws#13558 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(RDS): deploy-time value can't be used for nr of instances in Cluster
3 participants