From 28b60f4d5159b89ab3001cc5b9a391852b1b7508 Mon Sep 17 00:00:00 2001 From: Steven Nemetz Date: Thu, 21 Jun 2018 09:54:45 -0700 Subject: [PATCH] Add force destroy option --- main.tf | 7 ++++--- variables.tf | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 429b18a..9120cb4 100644 --- a/main.tf +++ b/main.tf @@ -54,15 +54,15 @@ module "labels" { resource "aws_s3_bucket" "this" { count = "${module.enabled.value ? length(var.names) : 0}" - bucket = "${module.labels.id[count.index]}" - acl = "${var.public ? "public-read" : "private"}" + bucket = "${module.labels.id[count.index]}" + acl = "${var.public ? "public-read" : "private"}" + force_destroy = "${var.force_destroy}" versioning { enabled = "${var.versioned}" } #acceleration_status - #force_destroy = true #lifecycle_rule {} #logging { # target_bucket @@ -71,6 +71,7 @@ resource "aws_s3_bucket" "this" { #region #request_payer #replication_configuration {} + #server_side_encryption_configuration tags = "${module.labels.tags[count.index]}" } diff --git a/variables.tf b/variables.tf index 57481db..807a8fc 100644 --- a/variables.tf +++ b/variables.tf @@ -87,6 +87,11 @@ variable "enabled" { default = true } +variable "force_destroy" { + description = "Delete all objects in bucket on destroy" + default = false +} + variable "principal" { description = "principal" default = "*"