Skip to content

Commit 49ae449

Browse files
authored
chore(sns): kms key is not deleted in integ.sns.ts (#29664)
### Issue # (if applicable) Closes #29663 ### Reason for this change kms key created within integ test remains after integ test. ### Description of changes Added "pendingWindow" and "removalPolicy" to kms resource. ```ts const key = new Key(this, 'CustomKey', { pendingWindow: Duration.days(7), removalPolicy: RemovalPolicy.DESTROY, }); ``` ### Description of how you validated changes I confirmed with integ test that it works as expected. ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 99e9589 commit 49ae449

File tree

5 files changed

+46
-41
lines changed

5 files changed

+46
-41
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/SNSInteg.assets.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/SNSInteg.template.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
}
3131
],
3232
"Version": "2012-10-17"
33-
}
33+
},
34+
"PendingWindowInDays": 7
3435
},
35-
"UpdateReplacePolicy": "Retain",
36-
"DeletionPolicy": "Retain"
36+
"UpdateReplacePolicy": "Delete",
37+
"DeletionPolicy": "Delete"
3738
},
3839
"MyTopic86869434": {
3940
"Type": "AWS::SNS::Topic",

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/manifest.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/tree.json

+34-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { Key } from 'aws-cdk-lib/aws-kms';
2-
import { App, Stack, StackProps } from 'aws-cdk-lib';
2+
import { App, Stack, StackProps, RemovalPolicy, Duration } from 'aws-cdk-lib';
33
import { LoggingProtocol, Topic } from 'aws-cdk-lib/aws-sns';
44
import { ManagedPolicy, PolicyDocument, PolicyStatement, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
55

66
class SNSInteg extends Stack {
77
constructor(scope: App, id: string, props?: StackProps) {
88
super(scope, id, props);
99

10-
const key = new Key(this, 'CustomKey');
10+
const key = new Key(this, 'CustomKey', {
11+
pendingWindow: Duration.days(7),
12+
removalPolicy: RemovalPolicy.DESTROY,
13+
});
1114

1215
const topic = new Topic(this, 'MyTopic', {
1316
topicName: 'fooTopic',

0 commit comments

Comments
 (0)