Skip to content

Commit

Permalink
feat(core-service): Expose deletionProtection property [CLK-270897] (#68
Browse files Browse the repository at this point in the history
)
  • Loading branch information
adigiorgi-clickup authored Jul 20, 2023
1 parent 03b654f commit 76f5413
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/aurora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ export interface AuroraProps {
* This also will target which database has default grants applied for users.
*/
readonly databaseName: string;
/**
* Indicates whether the DB cluster should have deletion protection enabled.
*
* @default - true if `removalPolicy` is RETAIN, `undefined` otherwise, which will not enable deletion protection.
* To disable deletion protection after it has been enabled, you must explicitly set this value to `false`.
*/
readonly deletionProtection?: boolean;
/**
* How many instances? DevOps strongly recommends at least 3 in prod environments and only 1 in dev environments.
* @default - passthrough
Expand Down Expand Up @@ -324,6 +331,7 @@ export class Aurora extends Construct {
encryptionKey,
secretName: secretName.addPrefix(secretPrefix).pascal,
},
deletionProtection: props.deletionProtection,
engine: aws_rds.DatabaseClusterEngine.auroraPostgres({
version,
}),
Expand Down
6 changes: 6 additions & 0 deletions test/aurora.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ describe('Aurora', () => {
template.resourceCountIs('Custom::AuroraActivityStream', 1);
expect(aurora.activityStreamArn).not.toBeFalsy();
});
it('deletionProtection', () => {
createAurora({ ...defaultAuroraProps, deletionProtection: false });
template.hasResourceProperties('AWS::RDS::DBCluster', {
DeletionProtection: false,
});
});
it('instances', () => {
createAurora({ ...defaultAuroraProps, instances: 12 });
template.resourceCountIs('AWS::RDS::DBInstance', 12);
Expand Down

0 comments on commit 76f5413

Please sign in to comment.