Skip to content

Commit

Permalink
Merge pull request #232 from RomaricKanyamibwa/master
Browse files Browse the repository at this point in the history
Add Retain as deletion policy for buckets
  • Loading branch information
RomaricKanyamibwa authored Jan 17, 2024
2 parents 319d4fd + 86d7499 commit c198ed0
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/e3/aws/troposphere/s3/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def resources(self, stack: Stack) -> list[AWSObject]:
notification_config, notification_resources = self.notification_setup
optional_resources.extend(notification_resources)

attr = {}
attr = {"DeletionPolicy": "Retain"}
for key, val in {
"BucketName": self.name,
"BucketEncryption": bucket_encryption,
Expand Down
1 change: 1 addition & 0 deletions tests/tests_e3_aws/troposphere/config/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"DependsOn": "AWSServiceRoleForConfig",
},
"ConfigTestBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "config-test-bucket",
"BucketEncryption": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"TestBucketWithRoles": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "test-bucket-with-roles",
"BucketEncryption": {
Expand Down
3 changes: 2 additions & 1 deletion tests/tests_e3_aws/troposphere/s3/bucket-with-roles.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"TestBucketWithRoles": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "test-bucket-with-roles",
"BucketEncryption": {
Expand Down Expand Up @@ -192,4 +193,4 @@
},
"Type": "AWS::IAM::Role"
}
}
}
1 change: 1 addition & 0 deletions tests/tests_e3_aws/troposphere/s3/bucket.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Type": "AWS::Lambda::Function"
},
"TestBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "test-bucket",
"BucketEncryption": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"TestBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "test-bucket",
"PublicAccessBlockConfiguration": {
Expand Down Expand Up @@ -69,4 +70,4 @@
},
"Type": "AWS::S3::BucketPolicy"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"TestBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "test-bucket",
"BucketEncryption": {
Expand Down
3 changes: 2 additions & 1 deletion tests/tests_e3_aws/troposphere/s3websitedistribution.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"HostBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "host-bucket",
"BucketEncryption": {
Expand Down Expand Up @@ -374,4 +375,4 @@
},
"Type": "AWS::Route53::RecordSet"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"HostBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "host-bucket",
"BucketEncryption": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"HostBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "host-bucket",
"BucketEncryption": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"HostBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "host-bucket",
"BucketEncryption": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"HostBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "host-bucket",
"BucketEncryption": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"MyBucket": {
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "my-bucket",
"BucketEncryption": {
Expand Down

0 comments on commit c198ed0

Please sign in to comment.