Skip to content

Commit 70b2759

Browse files
Merge pull request #41 from angstwad/fix-bucket-policy
Omitting log_location_prefix creates an invalid bucket policy
2 parents 47d7e36 + f9338c5 commit 70b2759

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

data.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data "aws_iam_policy_document" "bucket_policy" {
66
statement {
77
sid = "AllowToPutLoadBalancerLogsToS3Bucket"
88
actions = ["s3:PutObject"]
9-
resources = ["arn:aws:s3:::${var.log_bucket_name}/${var.log_location_prefix}/AWSLogs/${data.aws_caller_identity.current.account_id}/*"]
9+
resources = ["arn:aws:s3:::${var.log_bucket_name}/${var.log_location_prefix == "" ? "" : format("%s/", var.log_location_prefix)}AWSLogs/${data.aws_caller_identity.current.account_id}/*"]
1010

1111
principals {
1212
type = "AWS"

0 commit comments

Comments
 (0)