From 9155692f732cf66fb3823b0ca35f63ef16dbf01e Mon Sep 17 00:00:00 2001 From: Daniel Navarro Date: Fri, 13 Mar 2020 12:30:25 +1100 Subject: [PATCH 1/2] Add force_destroy = true --- master.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/master.tf b/master.tf index 89e8554..a78f843 100644 --- a/master.tf +++ b/master.tf @@ -8,6 +8,7 @@ locals { resource "aws_s3_bucket" "bucket" { count = var.is_guardduty_master && (var.has_ipset || var.has_threatintelset) ? 1 : 0 bucket = var.bucket_name + force_destroy = true acl = "private" } From 63135d994d4b7d72aaa9756b4ff43453de6e2fe8 Mon Sep 17 00:00:00 2001 From: Daniel Navarro Date: Thu, 19 Mar 2020 14:13:36 +1100 Subject: [PATCH 2/2] ADD bucket force_destroy variable --- master.tf | 2 +- variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/master.tf b/master.tf index a78f843..1d65f71 100644 --- a/master.tf +++ b/master.tf @@ -8,7 +8,7 @@ locals { resource "aws_s3_bucket" "bucket" { count = var.is_guardduty_master && (var.has_ipset || var.has_threatintelset) ? 1 : 0 bucket = var.bucket_name - force_destroy = true + force_destroy = var.force_destroy acl = "private" } diff --git a/variables.tf b/variables.tf index d03e08c..f3b28f7 100644 --- a/variables.tf +++ b/variables.tf @@ -4,6 +4,12 @@ variable "bucket_name" { default = "" } +variable "force_destroy" { + type = bool + description = "(Optional) A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable." + default = false +} + variable "is_guardduty_master" { type = bool description = "Whether the account is a master account"