File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,9 +68,8 @@ data "aws_iam_policy_document" "access_logs_policy" {
6868module "cyber_s3_log_shipping" {
6969 count = var. send_access_logs_to_cyber ? 1 : 0
7070
71- source = " ../cyber_s3_log_shipping"
72- s3_name = aws_s3_bucket. access_logs . id
73- destination = var. access_log_shipping_destination
71+ source = " ../cyber_s3_log_shipping"
72+ s3_name = aws_s3_bucket. access_logs . id
7473}
7574
7675data "aws_iam_policy_document" "access_logs_combined_policy" {
Original file line number Diff line number Diff line change @@ -15,14 +15,3 @@ variable "extra_bucket_policies" {
1515 description = " Extra bucket policies to apply to this bucket. List of json policies"
1616 default = []
1717}
18-
19- variable "access_log_shipping_destination" {
20- type = string
21- description = " The destination for log shipping. Valid values are 'cribl' or 'csls'."
22- default = " cribl"
23-
24- validation {
25- condition = contains ([" cribl" , " csls" ], var. access_log_shipping_destination )
26- error_message = " Invalid destination. Valid values are 'cribl' or 'csls'."
27- }
28- }
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- # S3 bucket notifications for both CSLS and Cribl
1+ module "cribl_well_known" {
2+ source = " ../well-known/cribl"
3+ }
4+
5+ # IAM policy for Cribl role to access S3 bucket
6+ data "aws_iam_policy_document" "cribl_s3_access" {
7+ statement {
8+ sid = " CriblS3Access"
9+
10+ principals {
11+ type = " AWS"
12+ identifiers = [module . cribl_well_known . cribl_role_arn ]
13+ }
214
3- locals {
4- enable_cribl = var. destination == " cribl"
5- enable_csls = var. destination == " csls"
15+ effect = " Allow"
16+
17+ actions = [
18+ " s3:GetObject" ,
19+ " s3:ListBucket" ,
20+ " s3:GetObjectTagging" ,
21+ " s3:PutObjectTagging"
22+ ]
23+
24+ resources = [
25+ " arn:aws:s3:::${ var . s3_name } " ,
26+ " arn:aws:s3:::${ var . s3_name } /*" ,
27+ ]
28+ }
629}
730
31+ # S3 bucket notifications
832resource "aws_s3_bucket_notification" "s3_bucket_notification" {
933 bucket = var. s3_name
1034
1135 # We can't push events to multiple SQS queues at once, so we conditionally choose
1236 # which queue to use based on the destination variable.
1337 queue {
14- queue_arn = local . enable_cribl ? module. cribl_well_known [ 0 ] . cribl_sqs_queue_arn : module . csls_well_known . s3_to_splunk_queue_arn
38+ queue_arn = module. cribl_well_known . cribl_sqs_queue_arn
1539 events = [" s3:ObjectCreated:*" ]
1640 }
1741}
Original file line number Diff line number Diff line change 11output "s3_policy" {
22 description = " S3 bucket policy for cyber security log shipping"
3- value = local . enable_cribl ? data. aws_iam_policy_document . cribl_s3_access [ 0 ] . json : data . aws_iam_policy_document . csls_s3_access [0 ]. json
3+ value = data. aws_iam_policy_document . cribl_s3_access [0 ]. json
44}
Original file line number Diff line number Diff line change @@ -2,14 +2,3 @@ variable "s3_name" {
22 type = string
33 description = " The name of the S3 bucket to configure for log shipping"
44}
5-
6- variable "destination" {
7- type = string
8- description = " The destination for log shipping. Valid values are 'cribl' or 'csls'."
9- default = " cribl"
10-
11- validation {
12- condition = contains ([" cribl" , " csls" ], var. destination )
13- error_message = " Invalid destination. Valid values are 'cribl' or 'csls'."
14- }
15- }
Original file line number Diff line number Diff line change @@ -666,10 +666,6 @@ data "aws_iam_policy_document" "eventbridge" {
666666 }
667667}
668668
669- module "csls_well_known" {
670- source = " ../well-known/csls"
671- }
672-
673669data "aws_iam_policy_document" "cloudwatch_logging" {
674670 statement {
675671 actions = [
@@ -685,15 +681,6 @@ data "aws_iam_policy_document" "cloudwatch_logging" {
685681 effect = " Allow"
686682 }
687683
688- statement {
689- sid = " PutSubscriptionFilterForCSLS"
690- actions = [
691- " logs:PutSubscriptionFilter" ,
692- ]
693- resources = values (module. csls_well_known . cloudwatch_to_splunk_destination_arns )
694- effect = " Allow"
695- }
696-
697684 statement {
698685 sid = " ManageSubscriptionFilterForCRIBL"
699686 actions = [
Original file line number Diff line number Diff line change @@ -90,8 +90,7 @@ module "access_logs_bucket" {
9090
9191 bucket_name = " ${ var . name } -access-logs"
9292
93- send_access_logs_to_cyber = var. send_access_logs_to_cyber
94- access_log_shipping_destination = var. access_log_shipping_destination
93+ send_access_logs_to_cyber = var. send_access_logs_to_cyber
9594}
9695
9796resource "aws_s3_bucket_logging" "this" {
Original file line number Diff line number Diff line change @@ -34,14 +34,3 @@ variable "send_access_logs_to_cyber" {
3434 default = true
3535 nullable = false
3636}
37-
38- variable "access_log_shipping_destination" {
39- type = string
40- description = " The destination for log shipping. Valid values are 'cribl' or 'csls'."
41- default = " cribl"
42-
43- validation {
44- condition = contains ([" cribl" , " csls" ], var. access_log_shipping_destination )
45- error_message = " Invalid destination. Valid values are 'cribl' or 'csls'."
46- }
47- }
You can’t perform that action at this time.
0 commit comments