74 lines
2.5 KiB
Terraform
74 lines
2.5 KiB
Terraform
locals {
|
|
vpc = var.protect_from_destroy ? aws_vpc.protected[0] : aws_vpc.unprotected[0]
|
|
|
|
subnet_ids = merge(
|
|
{ for key, subnet in aws_subnet.protected : key => subnet.id },
|
|
{ for key, subnet in aws_subnet.unprotected : key => subnet.id },
|
|
)
|
|
|
|
internet_gateway_id = var.protect_from_destroy ? aws_internet_gateway.protected[0].id : aws_internet_gateway.unprotected[0].id
|
|
|
|
route_table_ids = {
|
|
dmz = var.protect_from_destroy ? aws_default_route_table.protected[0].id : aws_default_route_table.unprotected[0].id
|
|
intra = var.protect_from_destroy ? aws_route_table.protected[0].id : aws_route_table.unprotected[0].id
|
|
}
|
|
|
|
routes = {
|
|
dmz_private_a = {
|
|
route_table_key = "dmz"
|
|
destination = var.route_destinations.private_network_a
|
|
gateway_id = null
|
|
network_interface_id = var.vyos_network_interface_id
|
|
}
|
|
dmz_private_b = {
|
|
route_table_key = "dmz"
|
|
destination = var.route_destinations.private_network_b
|
|
gateway_id = null
|
|
network_interface_id = var.vyos_network_interface_id
|
|
}
|
|
dmz_internet = {
|
|
route_table_key = "dmz"
|
|
destination = var.route_destinations.default_ipv4
|
|
gateway_id = local.internet_gateway_id
|
|
network_interface_id = null
|
|
}
|
|
intra_private_a = {
|
|
route_table_key = "intra"
|
|
destination = var.route_destinations.private_network_a
|
|
gateway_id = null
|
|
network_interface_id = var.vyos_network_interface_id
|
|
}
|
|
intra_private_b = {
|
|
route_table_key = "intra"
|
|
destination = var.route_destinations.private_network_b
|
|
gateway_id = null
|
|
network_interface_id = var.vyos_network_interface_id
|
|
}
|
|
intra_default = {
|
|
route_table_key = "intra"
|
|
destination = var.route_destinations.default_ipv4
|
|
gateway_id = null
|
|
network_interface_id = var.vyos_network_interface_id
|
|
}
|
|
}
|
|
|
|
route_table_associations = {
|
|
dmz = {
|
|
subnet_key = "dmz"
|
|
route_table_key = "dmz"
|
|
}
|
|
intra_a = {
|
|
subnet_key = "intra_a"
|
|
route_table_key = "intra"
|
|
}
|
|
intra_d = {
|
|
subnet_key = "intra_d"
|
|
route_table_key = "intra"
|
|
}
|
|
}
|
|
|
|
ssh_security_group_name = coalesce(var.ssh_security_group.name, "${var.name_prefix}-ssh-enabled")
|
|
web_instance_name = coalesce(var.web_instance.name, "${var.name_prefix}-web")
|
|
key_pair_name = coalesce(var.key_pair.name, "${var.name_prefix}-key")
|
|
}
|