Skip to content

add access-logging #19

Merged
merged 2 commits into from
Jul 29, 2020
Merged
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ resource "aws_s3_bucket" "this" {
enabled = true
}

logging {
target_bucket = var.access_log_bucket
target_prefix = "s3/{var.bucket_name}/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this in to a variable, but with a default. Add to variables.tf

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"
}

and then change this line to

  target_prefix = format("%s/%s/",var.access_log_bucket_prefix,var.access_log_bucket)

}

lifecycle {
prevent_destroy = true
}
Expand Down