Skip to content

Commit

Permalink
feat: specify autoMinorVersionUpgrade for a cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
badmintoncryer committed Oct 31, 2024
1 parent 6f106c7 commit 39b90da
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/aws-cdk-lib/aws-rds/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ interface DatabaseClusterBaseProps {
* @default - default master key
*/
readonly performanceInsightEncryptionKey?: kms.IKey;

/**
* Specifies whether minor engine upgrades are applied automatically to the DB cluster during the maintenance window.
*
* @default true
*/
readonly autoMinorVersionUpgrade?: boolean;
}

/**
Expand Down Expand Up @@ -795,6 +802,7 @@ abstract class DatabaseClusterNew extends DatabaseClusterBase {
performanceInsightsEnabled: this.performanceInsightsEnabled || props.enablePerformanceInsights, // fall back to undefined if not set
performanceInsightsKmsKeyId: this.performanceInsightEncryptionKey?.keyArn,
performanceInsightsRetentionPeriod: this.performanceInsightRetention,
autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
};
}

Expand Down
21 changes: 21 additions & 0 deletions packages/aws-cdk-lib/aws-rds/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,27 @@ describe('cluster new api', () => {
});

describe('cluster options', () => {
test.each([true, false])('specify auto minor version upgrade', (autoMinorVersionUpgrade) => {
// GIVEN
const stack = testStack();
const vpc = new ec2.Vpc(stack, 'VPC');

// WHEN
new DatabaseCluster(stack, 'Database', {
engine: DatabaseClusterEngine.AURORA_MYSQL,
vpc,
autoMinorVersionUpgrade,
writer: ClusterInstance.serverlessV2('writer'),
});

// THEN
const template = Template.fromStack(stack);
template.hasResourceProperties('AWS::RDS::DBCluster', {
Engine: 'aurora-mysql',
AutoMinorVersionUpgrade: autoMinorVersionUpgrade,
});
});

test('with serverless instances', () => {
// GIVEN
const stack = testStack();
Expand Down

0 comments on commit 39b90da

Please sign in to comment.