diff --git a/main.tf b/main.tf index 431f310..99e0a00 100644 --- a/main.tf +++ b/main.tf @@ -24,6 +24,11 @@ resource "aws_s3_bucket" "this" { enabled = true } +logging { + target_bucket = var.access_log_bucket + target_prefix = format("%s/%s/",var.access_log_bucket_prefix,var.access_log_bucket) +} + lifecycle { prevent_destroy = true } diff --git a/variables.tf b/variables.tf index 771bef0..e261ce1 100644 --- a/variables.tf +++ b/variables.tf @@ -20,3 +20,9 @@ variable "tags" { type = map(string) default = { } } + +variable "access_log_bucket_prefix" { + description = "Access log bucket prefix, to which the bucket name will be appended to make the target_prefix" + type = string + default = "s3" +}