Skip to content

Commit c198ed0

Browse files
Merge pull request #232 from RomaricKanyamibwa/master
Add Retain as deletion policy for buckets
2 parents 319d4fd + 86d7499 commit c198ed0

13 files changed

+16
-4
lines changed

src/e3/aws/troposphere/s3/bucket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def resources(self, stack: Stack) -> list[AWSObject]:
277277
notification_config, notification_resources = self.notification_setup
278278
optional_resources.extend(notification_resources)
279279

280-
attr = {}
280+
attr = {"DeletionPolicy": "Retain"}
281281
for key, val in {
282282
"BucketName": self.name,
283283
"BucketEncryption": bucket_encryption,

tests/tests_e3_aws/troposphere/config/config_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"DependsOn": "AWSServiceRoleForConfig",
132132
},
133133
"ConfigTestBucket": {
134+
"DeletionPolicy": "Retain",
134135
"Properties": {
135136
"BucketName": "config-test-bucket",
136137
"BucketEncryption": {

tests/tests_e3_aws/troposphere/s3/bucket-with-roles-trusted-accounts.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"TestBucketWithRoles": {
3+
"DeletionPolicy": "Retain",
34
"Properties": {
45
"BucketName": "test-bucket-with-roles",
56
"BucketEncryption": {

tests/tests_e3_aws/troposphere/s3/bucket-with-roles.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"TestBucketWithRoles": {
3+
"DeletionPolicy": "Retain",
34
"Properties": {
45
"BucketName": "test-bucket-with-roles",
56
"BucketEncryption": {
@@ -192,4 +193,4 @@
192193
},
193194
"Type": "AWS::IAM::Role"
194195
}
195-
}
196+
}

tests/tests_e3_aws/troposphere/s3/bucket.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"Type": "AWS::Lambda::Function"
3030
},
3131
"TestBucket": {
32+
"DeletionPolicy": "Retain",
3233
"Properties": {
3334
"BucketName": "test-bucket",
3435
"BucketEncryption": {

tests/tests_e3_aws/troposphere/s3/bucket_multi_encryption.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"TestBucket": {
3+
"DeletionPolicy": "Retain",
34
"Properties": {
45
"BucketName": "test-bucket",
56
"PublicAccessBlockConfiguration": {
@@ -69,4 +70,4 @@
6970
},
7071
"Type": "AWS::S3::BucketPolicy"
7172
}
72-
}
73+
}

tests/tests_e3_aws/troposphere/s3/bucket_notification_string_arns.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"TestBucket": {
3+
"DeletionPolicy": "Retain",
34
"Properties": {
45
"BucketName": "test-bucket",
56
"BucketEncryption": {

tests/tests_e3_aws/troposphere/s3websitedistribution.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"HostBucket": {
3+
"DeletionPolicy": "Retain",
34
"Properties": {
45
"BucketName": "host-bucket",
56
"BucketEncryption": {
@@ -374,4 +375,4 @@
374375
},
375376
"Type": "AWS::Route53::RecordSet"
376377
}
377-
}
378+
}

tests/tests_e3_aws/troposphere/s3websitedistribution_bucket.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"HostBucket": {
3+
"DeletionPolicy": "Retain",
34
"Properties": {
45
"BucketName": "host-bucket",
56
"BucketEncryption": {

tests/tests_e3_aws/troposphere/s3websitedistribution_iam_path.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"HostBucket": {
3+
"DeletionPolicy": "Retain",
34
"Properties": {
45
"BucketName": "host-bucket",
56
"BucketEncryption": {

0 commit comments

Comments
 (0)