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

Send flow logs to S3 #7995

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion terraform/environments/core-vpc/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ locals {

# Secrets used by Firehose resources which we only require for development & production VPCs.
xsiam = jsondecode(data.aws_secretsmanager_secret_version.xsiam_secret_arn_version.secret_string)
cloudwatch_log_buckets = jsondecode(data.aws_secretsmanager_secret_version.core_logging_bucket_arns.secret_string)
cloudwatch_log_buckets = nonsensitive(jsondecode(data.aws_secretsmanager_secret_version.core_logging_bucket_arns.secret_string))
cloudwatch_r53_resolver_log_groups = local.is-production ? [for env in module.route_53_resolver_logs : env.r53_resolver_log_name] : []
cloudwatch_vpc_flow_log_groups = local.is-production ? [for key, value in module.vpc : value.vpc_flow_log] : []

Expand Down
23 changes: 8 additions & 15 deletions terraform/environments/core-vpc/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,21 @@ locals {
}

module "vpc" {
for_each = local.vpcs[terraform.workspace]

source = "github.com/ministryofjustice/modernisation-platform-terraform-member-vpc?ref=c0475531b5c9f45a78a94fea441cd9ce91ad3c59" # v2.5.0

subnet_sets = { for key, subnet in each.value.cidr.subnet_sets : key => subnet.cidr }

for_each = local.vpcs[terraform.workspace]
source = "github.com/ministryofjustice/modernisation-platform-terraform-member-vpc?ref=c0475531b5c9f45a78a94fea441cd9ce91ad3c59" # v2.5.0
additional_endpoints = each.value.options.additional_endpoints

transit_gateway_id = data.aws_ec2_transit_gateway.transit-gateway.id
subnet_sets = { for key, subnet in each.value.cidr.subnet_sets : key => subnet.cidr }
transit_gateway_id = data.aws_ec2_transit_gateway.transit-gateway.id

# VPC Flow Logs
vpc_flow_log_iam_role = aws_iam_role.vpc_flow_log.arn
vpc_flow_log_iam_role = aws_iam_role.vpc_flow_log.arn
flow_log_s3_destination_arn = local.cloudwatch_log_buckets["vpc-flow-logs"]

# Variables required for Firehose integration. We are not building this in all environments hence the "build_firehose" condition below.

build_firehose = local.build_firehose

kinesis_endpoint_url = local.is-production ? tostring(local.xsiam["xsiam_prod_network_endpoint"]) : tostring(local.xsiam["xsiam_preprod_network_endpoint"])

build_firehose = local.build_firehose
kinesis_endpoint_url = local.is-production ? tostring(local.xsiam["xsiam_prod_network_endpoint"]) : tostring(local.xsiam["xsiam_preprod_network_endpoint"])
kinesis_endpoint_secret_string = local.is-production ? tostring(local.xsiam["xsiam_prod_network_secret"]) : tostring(local.xsiam["xsiam_preprod_network_secret"])


# Tags
tags_common = local.tags
tags_prefix = each.key
Expand Down