@@ -523,6 +523,22 @@ resource "aws_lb" "idxhec-noack" {
523523 drop_invalid_header_fields = true
524524 security_groups = [aws_security_group . splunk-lb-hecidx-outbound . id , aws_security_group . splunk-lbhecidx . id ]
525525 subnets = (local. use-elb-private == " false" ? [local . subnet_pub_1_id , local . subnet_pub_2_id , local . subnet_pub_3_id ] : [local . subnet_priv_1_id , local . subnet_priv_2_id , local . subnet_priv_3_id ])
526+ # Tracks HTTP Requests
527+ access_logs {
528+ bucket = aws_s3_bucket. s3_data . bucket
529+ prefix = " log/lbidxnoack"
530+ enabled = true
531+ }
532+ # Tracks TCP/TLS Connections (ALB only)
533+ connection_logs {
534+ bucket = aws_s3_bucket. s3_data . bucket
535+ prefix = " log/lbidxnoack"
536+ enabled = true
537+ }
538+ # Critical: Ensure the policy is attached before the LB tries to verify access
539+ depends_on = [
540+ aws_s3_bucket_policy . allow_access_for_lb_logs
541+ ]
526542}
527543
528544
@@ -534,6 +550,22 @@ resource "aws_lb" "idxhec-ack" {
534550 drop_invalid_header_fields = true
535551 security_groups = [aws_security_group . splunk-lb-hecidx-outbound . id , aws_security_group . splunk-lbhecidx . id ]
536552 subnets = (local. use-elb-private == " false" ? [local . subnet_pub_1_id , local . subnet_pub_2_id , local . subnet_pub_3_id ] : [local . subnet_priv_1_id , local . subnet_priv_2_id , local . subnet_priv_3_id ])
553+ # Tracks HTTP Requests
554+ access_logs {
555+ bucket = aws_s3_bucket. s3_data . bucket
556+ prefix = " log/lbidxack"
557+ enabled = true
558+ }
559+ # Tracks TCP/TLS Connections (ALB only)
560+ connection_logs {
561+ bucket = aws_s3_bucket. s3_data . bucket
562+ prefix = " log/lbidxack"
563+ enabled = true
564+ }
565+ # Critical: Ensure the policy is attached before the LB tries to verify access
566+ depends_on = [
567+ aws_s3_bucket_policy . allow_access_for_lb_logs
568+ ]
537569}
538570
539571
0 commit comments