From 09061b4f2b9e05c1f9f32451a3d61d115a76a5a1 Mon Sep 17 00:00:00 2001 From: Alex Jurkiewicz Date: Wed, 30 Jun 2021 16:22:07 +1000 Subject: [PATCH 1/3] Properly type the default replication filter object --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 7155bda1..9bcfd2a0 100644 --- a/main.tf +++ b/main.tf @@ -194,11 +194,11 @@ resource "aws_s3_bucket" "default" { # If the corresponding rule requires no filter, an empty configuration block filter {} must be specified. # See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket dynamic "filter" { - for_each = try(rules.value.filter, null) == null ? ["empty"] : [rules.value.filter] + for_each = try(rules.value.filter, null) == null ? [{prefix=null, tags={}}] : [rules.value.filter] content { prefix = try(filter.value.prefix, try(rules.value.prefix, null)) - tags = try(filter.value.tags, {}) + tags = filter.value.tags } } } From 3d8eb00b500327984d3220d735630661baf1824f Mon Sep 17 00:00:00 2001 From: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com> Date: Wed, 30 Jun 2021 06:32:03 +0000 Subject: [PATCH 2/3] Auto Format --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 9bcfd2a0..4304ded7 100644 --- a/main.tf +++ b/main.tf @@ -194,7 +194,7 @@ resource "aws_s3_bucket" "default" { # If the corresponding rule requires no filter, an empty configuration block filter {} must be specified. # See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket dynamic "filter" { - for_each = try(rules.value.filter, null) == null ? [{prefix=null, tags={}}] : [rules.value.filter] + for_each = try(rules.value.filter, null) == null ? [{ prefix = null, tags = {} }] : [rules.value.filter] content { prefix = try(filter.value.prefix, try(rules.value.prefix, null)) From 4bd1cfb9d76bcdfb724801d8c03eb6e725a48f1e Mon Sep 17 00:00:00 2001 From: Alex Jurkiewicz Date: Tue, 6 Jul 2021 15:03:41 +1000 Subject: [PATCH 3/3] Update main.tf --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 29fb6d08..de580519 100644 --- a/main.tf +++ b/main.tf @@ -198,7 +198,7 @@ resource "aws_s3_bucket" "default" { content { prefix = try(filter.value.prefix, try(rules.value.prefix, null)) - tags = filter.value.tags + tags = try(filter.value.tags, {}) } } }