File tree Expand file tree Collapse file tree 7 files changed +31
-18
lines changed Expand file tree Collapse file tree 7 files changed +31
-18
lines changed Original file line number Diff line number Diff line change 11# Tamr S3 Module Repo
22
3+ ## v1.2.1 - April 21st 2022
4+ * Replaces deprecated S3 arguments with resource blocks.
5+ * Replaces deprecated IAM policy document argument names.
6+
37## v1.2.0 - April 18th 2022
48* Resolves S3 bucket public access block tfsec vulnerability.
59
Original file line number Diff line number Diff line change 1- 1.2.0
1+ 1.2.1
Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ data "aws_s3_bucket" "existing-bucket" {
44}
55
66module "existing-bucket-iam-0" {
7- # source = "git::https://github.com/Datatamer/terraform-aws-s3.git//modules/bucket-iam-policy?ref=1.0.0 "
7+ # source = "git::https://github.com/Datatamer/terraform-aws-s3.git//modules/bucket-iam-policy?ref=1.2.1 "
88 source = " ../../modules/bucket-iam-policy"
99 bucket_name = data. aws_s3_bucket . existing-bucket . id
1010 read_write_paths = [" some/read-write-folder" ]
1111 tags = var. tags
1212}
1313
1414module "existing-bucket-iam-1" {
15- # source = "git::https://github.com/Datatamer/terraform-aws-s3.git//modules/bucket-iam-policy?ref=1.0.0 "
15+ # source = "git::https://github.com/Datatamer/terraform-aws-s3.git//modules/bucket-iam-policy?ref=1.2.1 "
1616 source = " ../../modules/bucket-iam-policy"
1717 bucket_name = data. aws_s3_bucket . existing-bucket . id
1818 read_write_paths = [" another/read-write-folder" ]
Original file line number Diff line number Diff line change 11module "minimal" {
2- # source = "git::https://github.com/Datatamer/terraform-aws-s3?ref=1.0.0 "
2+ # source = "git::https://github.com/Datatamer/terraform-aws-s3?ref=1.2.1 "
33 source = " ../../"
44 bucket_name = var. test_bucket_name
55 read_only_paths = var. read_only_paths # ["path/to/ro-folder"]
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ data "aws_iam_policy_document" "ro_source_policy_doc" {
2929data "aws_iam_policy_document" "path_specific_ro_doc" {
3030 count = length (local. ro_paths ) == 0 ? 0 : 1
3131
32- version = " 2012-10-17"
33- source_json = data. aws_iam_policy_document . ro_source_policy_doc [0 ]. json
32+ version = " 2012-10-17"
33+ source_policy_documents = [ data . aws_iam_policy_document . ro_source_policy_doc [0 ]. json ]
3434
3535 dynamic "statement" {
3636 for_each = local. ro_paths_map
@@ -86,8 +86,8 @@ data "aws_iam_policy_document" "rw_source_policy_doc" {
8686data "aws_iam_policy_document" "path_specific_rw_doc" {
8787 count = length (var. read_write_paths ) == 0 ? 0 : 1
8888
89- version = " 2012-10-17"
90- source_json = data. aws_iam_policy_document . rw_source_policy_doc [0 ]. json
89+ version = " 2012-10-17"
90+ source_policy_documents = [ data . aws_iam_policy_document . rw_source_policy_doc [0 ]. json ]
9191
9292 dynamic "statement" {
9393 for_each = local. rw_paths_map
Original file line number Diff line number Diff line change 1+
2+ # tfsec:ignore:aws-s3-enable-bucket-encryption:tfsec is yet not detecting the aws_s3_bucket_server_side_encryption_configuration resource block. https://github.com/aquasecurity/defsec/issues/489
13# tfsec:ignore:aws-s3-enable-bucket-logging tfsec:ignore:aws-s3-enable-versioning
24resource "aws_s3_bucket" "new_bucket" {
35 bucket = var. bucket_name
4- acl = " private"
5-
6- server_side_encryption_configuration {
7- rule {
8- apply_server_side_encryption_by_default {
9- sse_algorithm = " AES256"
10- }
11- }
12- }
136
147 force_destroy = var. force_destroy
158 tags = var. tags
169}
1710
11+ resource "aws_s3_bucket_server_side_encryption_configuration" "encryption_for_new_bucket" {
12+ bucket = aws_s3_bucket. new_bucket . id
13+ rule {
14+ apply_server_side_encryption_by_default {
15+ sse_algorithm = " AES256"
16+ }
17+ }
18+ }
19+
1820# Bucket policy to enforce AES256 server-side-encryption
1921resource "aws_s3_bucket_policy" "sse_bucket_policy" {
2022 bucket = aws_s3_bucket. new_bucket . id
@@ -27,6 +29,13 @@ resource "aws_s3_bucket_policy" "sse_bucket_policy" {
2729 )
2830}
2931
32+ # Sets S3 bucket ACL
33+ resource "aws_s3_bucket_acl" "acl_for_new_bucket" {
34+ bucket = aws_s3_bucket. new_bucket . id
35+ acl = " private"
36+ }
37+
38+ # Enabling S3 bucket public access block
3039resource "aws_s3_bucket_public_access_block" "for_new_bucket" {
3140 bucket = aws_s3_bucket. new_bucket . id
3241
Original file line number Diff line number Diff line change 11module "minimal" {
2- # source = "git::https://github.com/Datatamer/terraform-aws-s3?ref=1.0.0 "
2+ # source = "git::https://github.com/Datatamer/terraform-aws-s3?ref=1.2.1 "
33 source = " ../../examples/minimal"
44 test_bucket_name = var. test_bucket_name
55 read_only_paths = var. read_only_paths
You can’t perform that action at this time.
0 commit comments