diff --git a/modules/storage/s3_bucket_2023/main.tf b/modules/storage/s3_bucket_2023/main.tf index 3906bf9..26cc06d 100644 --- a/modules/storage/s3_bucket_2023/main.tf +++ b/modules/storage/s3_bucket_2023/main.tf @@ -1,5 +1,6 @@ resource "aws_s3_bucket" "this" { - bucket = var.bucket_name + bucket = var.bucket_name + force_destroy = var.bucket_force_destroy } resource "aws_s3_bucket_public_access_block" "block_public_access" { @@ -20,7 +21,7 @@ data "aws_iam_policy_document" "bucket_policy" { actions = ["s3:*"] effect = "Deny" principals { - type = "*" + type = "*" identifiers = ["*"] } resources = [ diff --git a/modules/storage/s3_bucket_2023/variables.tf b/modules/storage/s3_bucket_2023/variables.tf index 91423d2..0b7a852 100644 --- a/modules/storage/s3_bucket_2023/variables.tf +++ b/modules/storage/s3_bucket_2023/variables.tf @@ -3,6 +3,12 @@ variable "bucket_name" { description = "Name of bucket" } +variable bucket_force_destroy { + type = bool + default = false + description = "Indicates all objects should be deleted from the bucket when the bucket is destroyed." +} + variable "bucket_policy_json" { type = string default = "{}"