Skip to content

Commit c0c5731

Browse files
authored
Initial updates for supporting s3 bucket logging targets. (#302)
* Support s3 bucket logging targets.
1 parent 83e12bc commit c0c5731

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

aws-s3-private-bucket/main.tf

+7-5
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,13 @@ resource "aws_s3_bucket" "bucket" {
110110
}
111111
}
112112

113-
# TODO
114-
# logging {
115-
# target_bucket = ""
116-
# target_prefix = ""
117-
# }
113+
dynamic "logging" {
114+
for_each = var.logging_bucket == null ? [] : [var.logging_bucket]
115+
content {
116+
target_bucket = var.logging_bucket.name
117+
target_prefix = var.logging_bucket.prefix
118+
}
119+
}
118120

119121
server_side_encryption_configuration {
120122
rule {

aws-s3-private-bucket/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ variable "transfer_acceleration" {
7171
default = false
7272
}
7373

74+
variable "logging_bucket" {
75+
type = object({ name = string, prefix = string })
76+
description = "Log bucket name and prefix to enable logs for this bucket"
77+
default = null
78+
}
79+
7480
variable "public_access_block" {
7581
type = bool
7682
default = true

0 commit comments

Comments
 (0)