Skip to content

Commit 76f5413

Browse files
feat(core-service): Expose deletionProtection property [CLK-270897] (#68)
1 parent 03b654f commit 76f5413

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

API.md

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/aurora.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ export interface AuroraProps {
5959
* This also will target which database has default grants applied for users.
6060
*/
6161
readonly databaseName: string;
62+
/**
63+
* Indicates whether the DB cluster should have deletion protection enabled.
64+
*
65+
* @default - true if `removalPolicy` is RETAIN, `undefined` otherwise, which will not enable deletion protection.
66+
* To disable deletion protection after it has been enabled, you must explicitly set this value to `false`.
67+
*/
68+
readonly deletionProtection?: boolean;
6269
/**
6370
* How many instances? DevOps strongly recommends at least 3 in prod environments and only 1 in dev environments.
6471
* @default - passthrough
@@ -324,6 +331,7 @@ export class Aurora extends Construct {
324331
encryptionKey,
325332
secretName: secretName.addPrefix(secretPrefix).pascal,
326333
},
334+
deletionProtection: props.deletionProtection,
327335
engine: aws_rds.DatabaseClusterEngine.auroraPostgres({
328336
version,
329337
}),

test/aurora.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ describe('Aurora', () => {
194194
template.resourceCountIs('Custom::AuroraActivityStream', 1);
195195
expect(aurora.activityStreamArn).not.toBeFalsy();
196196
});
197+
it('deletionProtection', () => {
198+
createAurora({ ...defaultAuroraProps, deletionProtection: false });
199+
template.hasResourceProperties('AWS::RDS::DBCluster', {
200+
DeletionProtection: false,
201+
});
202+
});
197203
it('instances', () => {
198204
createAurora({ ...defaultAuroraProps, instances: 12 });
199205
template.resourceCountIs('AWS::RDS::DBInstance', 12);

0 commit comments

Comments
 (0)