-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Describe the bug
This pull request (introduced in CDK 2.171.0) is adding validation to RDS DatabaseCluster Construct Monitoring Interval field: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseCluster.html#monitoringinterval
#32157
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
2.170.0
Expected Behavior
Token should be an acceptable value for monitoring interval
Current Behavior
Only number is accepted for monitoring interval field.
Error: 'monitoringInterval' must be one of 0, 1, 5, 10, 15, 30, or 60 seconds, got: ${Token[TOKEN.4704]} seconds.
at new DatabaseClusterNew (../node_modules/aws-cdk-lib/aws-rds/lib/cluster.js:1:8607)
at new DatabaseCluster (../node_modules/aws-cdk-lib/aws-rds/lib/cluster.js:5:4525)
Reproduction Steps
Create CfnParameter and try to use CfnParameter field in RDS DatabaseCluster construct
this.monitoringInterval = new CfnParameter(this, 'MonitoringInterval', {
type: 'String',
description:
'The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instance',
constraintDescription: 'Must be one of these: 1, 5, 10, 15, 30, or 60',
default: '60',
allowedValues: ['1', '5', '10', '15', '30', '60']
})
...
new DatabaseCluster(
...
monitoringInterval: Duration.seconds(this.monitoringInterval.valueAsString),
...
)
Possible Solution
Allow monitoringInterval to be a token or a number instead of only number.
Additional Information/Context
As a workaround, property override can be used to bypass this issue.
CDK CLI Version
2.179.0
Framework Version
No response
Node.js Version
22.13.1
OS
Ubuntu 24.04
Language
TypeScript
Language Version
TypeScript 5.7.3