Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CxPolicy[result] {

not common_lib.valid_key(s3, "logging") # version before TF AWS 4.0
not tf_lib.has_target_resource(bucketName, "aws_s3_bucket_logging") # version after TF AWS 4.0
not is_logging_target(bucketName)

result := {
"documentId": input.document[i].id,
Expand Down Expand Up @@ -38,3 +39,9 @@ CxPolicy[result] {
"searchLine": common_lib.build_search_line(["module", name], []),
}
}

is_logging_target(bucketName) {
some name
logging := input.document[i].resource.aws_s3_bucket_logging[name]
logging.target_bucket == sprintf("${aws_s3_bucket.%s.id}", [bucketName])
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource "aws_s3_bucket" "attachments_bucket" {
bucket = "${local.env_app_name}-attachments"
}

resource "aws_s3_bucket" "log_bucket" {
bucket = "${local.env_app_name}-attachments-logs"
}

resource "aws_s3_bucket_logging" "logging" {
bucket = aws_s3_bucket.attachments_bucket.id

target_bucket = aws_s3_bucket.log_bucket.id
target_prefix = "log/"
}
Loading