From c90f4c971416171f591c47872d15aeaf8fa27435 Mon Sep 17 00:00:00 2001 From: nitrocode Date: Fri, 22 Apr 2022 07:58:34 -0500 Subject: [PATCH 1/3] Use object lock enabled --- main.tf | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/main.tf b/main.tf index 57c960ff..6d6e2b1b 100644 --- a/main.tf +++ b/main.tf @@ -2,6 +2,7 @@ locals { enabled = module.this.enabled partition = join("", data.aws_partition.current.*.partition) + object_lock_enabled = local.enabled && var.object_lock_configuration != null replication_enabled = local.enabled && var.s3_replication_enabled versioning_enabled = local.enabled && var.versioning_enabled transfer_acceleration_enabled = local.enabled && var.transfer_acceleration_enabled @@ -37,14 +38,8 @@ resource "aws_s3_bucket" "default" { count = local.enabled ? 1 : 0 bucket = local.bucket_name force_destroy = var.force_destroy - - dynamic "object_lock_configuration" { - for_each = var.object_lock_configuration != null ? [1] : [] - - content { - object_lock_enabled = "Enabled" - } - } + + object_lock_enabled = local.object_lock_enabled tags = module.this.tags } @@ -289,7 +284,7 @@ resource "aws_s3_bucket_replication_configuration" "default" { } resource "aws_s3_bucket_object_lock_configuration" "default" { - count = local.enabled && var.object_lock_configuration != null ? 1 : 0 + count = local.object_lock_enabled ? 1 : 0 bucket = join("", aws_s3_bucket.default.*.id) From 04397bf6078c7e72eb8b4bde965741e65296e79a Mon Sep 17 00:00:00 2001 From: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com> Date: Fri, 22 Apr 2022 13:00:06 +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 6d6e2b1b..bf1ba147 100644 --- a/main.tf +++ b/main.tf @@ -38,7 +38,7 @@ resource "aws_s3_bucket" "default" { count = local.enabled ? 1 : 0 bucket = local.bucket_name force_destroy = var.force_destroy - + object_lock_enabled = local.object_lock_enabled tags = module.this.tags From 021ec9097ebf6a1514e1ebe8be2971e3d9299129 Mon Sep 17 00:00:00 2001 From: Nuru Date: Fri, 6 May 2022 12:12:57 -0700 Subject: [PATCH 3/3] Update go-getter for security fix --- test/src/go.mod | 2 +- test/src/go.sum | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/src/go.mod b/test/src/go.mod index 248339c9..952905a9 100644 --- a/test/src/go.mod +++ b/test/src/go.mod @@ -32,7 +32,7 @@ require ( github.com/gruntwork-io/go-commons v0.8.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.5.9 // indirect + github.com/hashicorp/go-getter v1.5.11 // indirect github.com/hashicorp/go-multierror v1.1.0 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.3.0 // indirect diff --git a/test/src/go.sum b/test/src/go.sum index e550698b..d66c0c62 100644 --- a/test/src/go.sum +++ b/test/src/go.sum @@ -98,6 +98,7 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= @@ -458,8 +459,9 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.5.9 h1:b7ahZW50iQiUek/at3CvZhPK1/jiV6CtKcsJiR6E4R0= github.com/hashicorp/go-getter v1.5.9/go.mod h1:BrrV/1clo8cCYu6mxvboYg+KutTiFnXjMEgDD8+i7ZI= +github.com/hashicorp/go-getter v1.5.11 h1:wioTuNmaBU3IE9vdFtFMcmZWj0QzLc6DYaP6sNe5onY= +github.com/hashicorp/go-getter v1.5.11/go.mod h1:9i48BP6wpWweI/0/+FBjqLrp9S8XtwUGjiu0QkWHEaY= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= @@ -479,6 +481,7 @@ github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl/v2 v2.9.1 h1:eOy4gREY0/ZQHNItlfuEZqtcQbXIxzojlP301hDpnac= github.com/hashicorp/hcl/v2 v2.9.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=