# # VPC part
# module "main_vpc" {
#   source = "../../../modules/vpc/vpc_v2"
#
#   name_prefix       = local.name_prefix
#   cidr_second_octet = var.vpc["cidr_second_octet"]
#
#   flow_logs = {
#     prisma_cloud = {
#       iam_role_arn    = data.aws_iam_role.redlock_flow_logs.arn
#       log_destination = data.aws_cloudwatch_log_group.redlock_logs.arn
#       traffic_type    = "ALL"
#     },
#     gsirt = {
#       log_destination      = "${data.aws_s3_bucket.security_logs.arn}/vpcflow/"
#       log_destination_type = "s3"
#       traffic_type         = "REJECT"
#     }
#   }
#
#   common_tags = merge(
#     local.common_tags,
#     {
#       project                  = "Infrastructure",
#       service                  = "Networking",
#       plat_env_project_service = "${local.aggregated_tag}_INFRA_NTW"
#     }
#   )
# }
#
# module "main_public_subnets" {
#   source             = "../../../modules/vpc/subnet"
#   name_prefix        = local.name_prefix
#   subnets            = var.public_subnets
#   vpc_id             = module.main_vpc.vpc_id
#   is_public          = true
#   cidr_second_octet  = var.vpc["cidr_second_octet"]
#   availability_zones = local.availability_zones
#   common_tags = merge(
#     local.common_tags,
#     {
#       project                  = "Infrastructure",
#       service                  = "Networking",
#       plat_env_project_service = "${local.aggregated_tag}_INFRA_NTW"
#     }
#   )
# }
#
# module "main_public_routing" {
#   source      = "../../../modules/vpc/routes"
#   is_public   = true
#   name_prefix = local.name_prefix
#   vpc_id      = module.main_vpc.vpc_id
#   vpc_cidr    = module.main_vpc.vpc_cidr
#   igw_id      = module.main_vpc.vpc_igw
#   subnets     = module.main_public_subnets.subnet_ids
#   common_tags = merge(
#     local.common_tags,
#     {
#       project                  = "Infrastructure",
#       service                  = "Networking",
#       plat_env_project_service = "${local.aggregated_tag}_INFRA_NTW"
#     }
#   )
# }
#
# module "main_private_subnets" {
#   source             = "../../../modules/vpc/subnet"
#   name_prefix        = local.name_prefix
#   subnets            = var.private_subnets
#   vpc_id             = module.main_vpc.vpc_id
#   is_public          = false
#   cidr_second_octet  = var.vpc["cidr_second_octet"]
#   availability_zones = local.availability_zones
#   common_tags = merge(
#     local.common_tags,
#     {
#       project                  = "Infrastructure",
#       service                  = "Networking",
#       plat_env_project_service = "${local.aggregated_tag}_INFRA_NTW"
#     }
#   )
# }
#
# module "main_nat_gateways" {
#   source      = "../../../modules/vpc/nat"
#   name_prefix = local.name_prefix
#   # Not using NAT gateway redundancy in dev
#   public_subnet_ids = [module.main_public_subnets.subnet_ids[1]]
#   common_tags = merge(
#     local.common_tags,
#     {
#       project                  = "Infrastructure",
#       service                  = "Networking",
#       plat_env_project_service = "${local.aggregated_tag}_INFRA_NTW"
#     }
#   )
# }
#
# # In some environments it's better to create multiple nat gateways, one per availability zone.
# module "main_private_routing" {
#   source         = "../../../modules/vpc/routes"
#   is_public      = false
#   name_prefix    = local.name_prefix
#   vpc_id         = module.main_vpc.vpc_id
#   vpc_cidr       = module.main_vpc.vpc_cidr
#   nat_gateway_id = module.main_nat_gateways.nats[0].id
#   subnets        = module.main_private_subnets.subnet_ids
#   common_tags = merge(
#     local.common_tags,
#     {
#       project                  = "Infrastructure",
#       service                  = "Networking",
#       plat_env_project_service = "${local.aggregated_tag}_INFRA_NTW"
#     }
#   )
# }
#
# data "aws_ec2_transit_gateway" "transit_gateway" {
#   filter {
#     name   = "options.amazon-side-asn"
#     values = ["64513"]
#   }
# }
#
# data "aws_ec2_managed_prefix_list" "vpn_ny_users" {
#   filter {
#     name   = "prefix-list-name"
#     values = ["vpn-ny-users"]
#   }
# }
#
# resource "aws_ec2_transit_gateway_vpc_attachment" "transit_gateway_attachment" {
#   vpc_id             = module.main_vpc.vpc_id
#   transit_gateway_id = data.aws_ec2_transit_gateway.transit_gateway.id
#   subnet_ids = concat(
#     module.main_private_subnets.subnet_ids,
#   )
# }
#
# resource "aws_route" "ny" {
#   for_each = toset([module.main_private_routing.route_table_id, module.main_public_routing.route_table_id])
#
#   route_table_id             = each.value
#   destination_prefix_list_id = data.aws_ec2_managed_prefix_list.vpn_ny_users.id
#   transit_gateway_id         = data.aws_ec2_transit_gateway.transit_gateway.id
# }
