Skip to content

Commit

Permalink
adding Module to test if Logs for ALB work
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Elhaiek committed Apr 9, 2024
1 parent b4ff8f9 commit 021c825
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions terraform/modules/alb_logging/main.tf
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
# }

0 comments on commit 021c825

Please sign in to comment.