-
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(rds): unable to use tokens as port in DatabaseInstance
#17995
Conversation
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.
Thanks for the contribution @jumic! A few tiny comments first.
@@ -746,7 +746,7 @@ abstract class DatabaseInstanceNew extends DatabaseInstanceBase implements IData | |||
performanceInsightsRetentionPeriod: enablePerformanceInsights | |||
? (props.performanceInsightRetention || PerformanceInsightRetention.DEFAULT) | |||
: undefined, | |||
port: props.port?.toString(), | |||
port: props.port ? Tokenization.stringifyNumber(props.port) : undefined, |
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.
Two things:
- I think you want the condition to be
props.port === undefined
, as 0 is falsy in JavaScript. - I believe you can use
Token.toString(props.port)
instead - it's more of the idiomatic way to do it (Tokenization
is more of an internal class).
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.
- Good catch. 0 is a valid port number. I changed it.
- Method
Token.toString()
doesn't accept an attribute. So I can't use it. Should I try something else? Or isTokenization.stringifyNumber(props.port)
the only way to handle it?
Pull request has been modified.
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.
Awesome, thanks for the contribution @jumic!
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). |
In `DatabaseInstance` the port number can be specified using data type number. If a token value (e.g. CloudFormation Parameter) was used here, the token was not resolved correctly. The conversion of property `port` has been corrected by using method `Tokenization.stringifyNumber()`. Fixes aws#17948. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
In
DatabaseInstance
the port number can be specified using data type number.If a token value (e.g. CloudFormation Parameter) was used here, the token was not resolved correctly.
The conversion of property
port
has been corrected by using methodTokenization.stringifyNumber()
.Fixes #17948.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license