diff --git a/main.tf b/main.tf index 4cbdf74..99e0a00 100644 --- a/main.tf +++ b/main.tf @@ -26,7 +26,7 @@ resource "aws_s3_bucket" "this" { logging { target_bucket = var.access_log_bucket - target_prefix = "s3/{var.bucket_name}/" + target_prefix = format("%s/%s/",var.access_log_bucket_prefix,var.access_log_bucket) } lifecycle { 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" +}