43 lines
1.6 KiB
HCL
43 lines
1.6 KiB
HCL
resource "openstack_networking_network_v2" "main-private-network" {
|
|
name = var.main_private_network["name"]
|
|
admin_state_up = "true"
|
|
external = "false"
|
|
description = var.main_private_network.description
|
|
dns_domain = var.dns-zone
|
|
mtu = var.mtu_size
|
|
port_security_enabled = true
|
|
shared = false
|
|
region = var.main_region
|
|
}
|
|
|
|
resource "openstack_networking_subnet_v2" "main-private-subnet" {
|
|
name = var.main_private_subnet.name
|
|
description = var.main_private_subnet.description
|
|
network_id = openstack_networking_network_v2.main-private-network.id
|
|
cidr = var.main_private_subnet.cidr
|
|
gateway_ip = var.main_private_subnet.gateway_ip
|
|
dns_nameservers = var.resolvers_ip
|
|
ip_version = 4
|
|
enable_dhcp = true
|
|
allocation_pool {
|
|
start = var.main_private_subnet.allocation_start
|
|
end = var.main_private_subnet.allocation_end
|
|
}
|
|
}
|
|
|
|
# Shell command:
|
|
# openstack --os-cloud d4s-pre router create --description "D4Science Preprod main router" --external-gateway external-network d4s-pre-cloud-external-router
|
|
# resource "openstack_networking_router_v2" "external-router" {
|
|
# name = var.external_router.name
|
|
# description = var.external_router.description
|
|
# external_network_id = var.external_network.id
|
|
# enable_snat = true
|
|
# }
|
|
|
|
# Router interface configuration
|
|
resource "openstack_networking_router_interface_v2" "private-network-routing" {
|
|
# router_id = openstack_networking_router_v2.external-router.id
|
|
router_id = var.external_router.id
|
|
subnet_id = openstack_networking_subnet_v2.main-private-subnet.id
|
|
}
|