Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firehose Data Transfers - Adds an additional module call but for the firewall vpc flow logs. #6545

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion terraform/environments/core-network-services/firehose.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@

locals {

firewall_logs = toset([module.vpc_inspection["live_data"].fw_cloudwatch_name, module.vpc_inspection["non_live_data"].fw_cloudwatch_name, module.firewall_logging.cloudwatch_log_group_name])
firewall_logs = toset([module.vpc_inspection["live_data"].fw_cloudwatch_name, module.vpc_inspection["non_live_data"].fw_cloudwatch_name, module.firewall_logging.cloudwatch_log_group_name])

firewall_vpc_logs = toset([module.vpc_inspection["live_data"].vpc_cloudwatch_name, module.vpc_inspection["non_live_data"].vpc_cloudwatch_name, aws_cloudwatch_log_group.external_inspection.name])

}

# The initial call is for the creation of firehose stream resources for the firewall inspection logs.

module "external_inspection_firehose" {
source = "../../modules/firehose"
for_each = local.firewall_logs
Expand All @@ -16,4 +20,16 @@ module "external_inspection_firehose" {
tags = local.tags
xsiam_endpoint = substr(each.value, 3, 3) != "non" ? tostring(local.xsiam["xsiam_prod_firewall_endpoint"]) : tostring(local.xsiam["xsiam_preprod_firewall_endpoint"])
xsiam_secret = substr(each.value, 3, 3) != "non" ? tostring(local.xsiam["xsiam_prod_firewall_secret"]) : tostring(local.xsiam["xsiam_preprod_firewall_secret"])
}

# A 2nd call of the module which will generate the firehose streams for the firewall vpc flow logs.

module "firehose_for_firewall_vpc_flow_logs" {
source = "../../modules/firehose"
for_each = local.firewall_vpc_logs
resource_prefix = format("%s-vpc", substr(each.value, 0, 3)) # As above but we add an additional identifier
log_group_name = each.value
tags = local.tags
xsiam_endpoint = substr(each.value, 0, 3) != "non" ? tostring(local.xsiam["xsiam_prod_network_endpoint"]) : tostring(local.xsiam["xsiam_preprod_network_endpoint"])
xsiam_secret = substr(each.value, 0, 3) != "non" ? tostring(local.xsiam["xsiam_prod_network_secret"]) : tostring(local.xsiam["xsiam_preprod_network_secret"])
}
Loading