Skip to content

Commit 28b60f4

Browse files
author
Steven Nemetz
committed
Add force destroy option
1 parent dfd9041 commit 28b60f4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ module "labels" {
5454
resource "aws_s3_bucket" "this" {
5555
count = "${module.enabled.value ? length(var.names) : 0}"
5656

57-
bucket = "${module.labels.id[count.index]}"
58-
acl = "${var.public ? "public-read" : "private"}"
57+
bucket = "${module.labels.id[count.index]}"
58+
acl = "${var.public ? "public-read" : "private"}"
59+
force_destroy = "${var.force_destroy}"
5960

6061
versioning {
6162
enabled = "${var.versioned}"
6263
}
6364

6465
#acceleration_status
65-
#force_destroy = true
6666
#lifecycle_rule {}
6767
#logging {
6868
# target_bucket
@@ -71,6 +71,7 @@ resource "aws_s3_bucket" "this" {
7171
#region
7272
#request_payer
7373
#replication_configuration {}
74+
#server_side_encryption_configuration
7475
tags = "${module.labels.tags[count.index]}"
7576
}
7677

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ variable "enabled" {
8787
default = true
8888
}
8989

90+
variable "force_destroy" {
91+
description = "Delete all objects in bucket on destroy"
92+
default = false
93+
}
94+
9095
variable "principal" {
9196
description = "principal"
9297
default = "*"

0 commit comments

Comments
 (0)