-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding Module to test if Logs for ALB work
- Loading branch information
Miguel Elhaiek
committed
Apr 9, 2024
1 parent
b4ff8f9
commit 021c825
Showing
1 changed file
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
resource "aws_s3_bucket" "logging_bucket" { | ||
bucket = var.bucket_name | ||
bucket = var.bucket_name | ||
} | ||
|
||
data "aws_elb_service_account" "main" {} | ||
|
||
data "aws_iam_policy_document" "bucket_policy" { | ||
statement { | ||
statement { | ||
actions = ["s3:PutObject"] | ||
resources = ["${aws_s3_bucket.logging_bucket.arn}/*"] | ||
|
||
principals { | ||
type = "AWS" | ||
identifiers = [data.aws_elb_service_account.main.arn] | ||
identifiers = ["arn:aws:iam::127311923021:root"] // ELB service account for US East (N. Virginia) | ||
} | ||
} | ||
} | ||
|
||
// Add any additional statements here if needed | ||
} | ||
|
||
resource "aws_s3_bucket_policy" "bucket_policy" { | ||
bucket = aws_s3_bucket.logging_bucket.id | ||
policy = data.aws_iam_policy_document.bucket_policy.json | ||
resource "aws_s3_bucket_policy" "logging_bucket_policy" { | ||
bucket = aws_s3_bucket.logging_bucket.id | ||
policy = data.aws_iam_policy_document.bucket_policy.json | ||
} | ||
|
||
|
||
|
||
# resource "aws_s3_bucket_policy" "bucket_policy" { | ||
# bucket = aws_s3_bucket.logging_bucket.id | ||
# policy = data.aws_iam_policy_document.bucket_policy.json | ||
# } |