Skip to content

Commit c7896db

Browse files
committed
chore: Use default DeletionProtectionEnabled property of Dynamo table
1 parent 119b116 commit c7896db

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

cdk/lib/__snapshots__/report.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@ exports[`The Report stack matches the snapshot for CODE 1`] = `
14791479
},
14801480
],
14811481
"BillingMode": "PAY_PER_REQUEST",
1482+
"DeletionProtectionEnabled": true,
14821483
"GlobalSecondaryIndexes": [
14831484
{
14841485
"IndexName": "sentTime-index",
@@ -3316,6 +3317,7 @@ exports[`The Report stack matches the snapshot for PROD 1`] = `
33163317
},
33173318
],
33183319
"BillingMode": "PAY_PER_REQUEST",
3320+
"DeletionProtectionEnabled": true,
33193321
"GlobalSecondaryIndexes": [
33203322
{
33213323
"IndexName": "sentTime-index",

cdk/lib/report.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { GuCname } from '@guardian/cdk/lib/constructs/dns';
66
import { GuDynamoTable } from '@guardian/cdk/lib/constructs/dynamodb';
77
import { GuAllowPolicy } from '@guardian/cdk/lib/constructs/iam';
88
import { GuEc2AppExperimental } from '@guardian/cdk/lib/experimental/patterns/ec2-app';
9-
import type { App, CfnResource } from 'aws-cdk-lib';
9+
import type { App } from 'aws-cdk-lib';
1010
import { Duration, RemovalPolicy } from 'aws-cdk-lib';
1111
import type { CfnAutoScalingGroup } from 'aws-cdk-lib/aws-autoscaling';
1212
import {
@@ -58,11 +58,6 @@ export class Report extends GuStack {
5858
timeToLiveAttribute: 'ttl',
5959
});
6060

61-
// Remove DeletionProtectionEnabled property to match YAML defined version of the table
62-
(dynamoTable.node.defaultChild as CfnResource).addPropertyDeletionOverride(
63-
'DeletionProtectionEnabled',
64-
);
65-
6661
dynamoTable.addGlobalSecondaryIndex({
6762
indexName: 'sentTime-index',
6863
partitionKey: { name: 'type', type: AttributeType.STRING },

0 commit comments

Comments
 (0)