Skip to content

Commit b04894f

Browse files
authored
feat: Added new S3 bucket policy statement for latest regions (#218)
1 parent a123254 commit b04894f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

examples/complete/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ provider "aws" {
22
region = local.region
33

44
# Make it faster by skipping something
5-
skip_get_ec2_platforms = true
65
skip_metadata_api_check = true
76
skip_region_validation = true
87
skip_credentials_validation = true

main.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ data "aws_elb_service_account" "this" {
531531
data "aws_iam_policy_document" "elb_log_delivery" {
532532
count = local.create_bucket && var.attach_elb_log_delivery_policy ? 1 : 0
533533

534+
# Policy for AWS Regions created before August 2022 (e.g. US East (N. Virginia), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Europe (Ireland))
534535
statement {
535536
sid = ""
536537

@@ -549,6 +550,26 @@ data "aws_iam_policy_document" "elb_log_delivery" {
549550
"${aws_s3_bucket.this[0].arn}/*",
550551
]
551552
}
553+
554+
# Policy for AWS Regions created after August 2022 (e.g. Asia Pacific (Hyderabad), Asia Pacific (Melbourne), Europe (Spain), Europe (Zurich), Middle East (UAE))
555+
statement {
556+
sid = ""
557+
558+
principals {
559+
type = "Service"
560+
identifiers = ["logdelivery.elasticloadbalancing.amazonaws.com"]
561+
}
562+
563+
effect = "Allow"
564+
565+
actions = [
566+
"s3:PutObject",
567+
]
568+
569+
resources = [
570+
"${aws_s3_bucket.this[0].arn}/*",
571+
]
572+
}
552573
}
553574

554575
# ALB/NLB

0 commit comments

Comments
 (0)