-
Notifications
You must be signed in to change notification settings - Fork 2
/
02-net.tf
32 lines (29 loc) · 1.03 KB
/
02-net.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
data "openstack_networking_network_v2" "dmz_net" {
name = var.floating_ip_network
}
resource "openstack_networking_network_v2" "tp_net" {
name = "tp-net"
admin_state_up = "true"
port_security_enabled = "true"
}
resource "openstack_networking_subnet_v2" "tp_subnet" {
name = "tp-subnet"
network_id = openstack_networking_network_v2.tp_net.id
cidr = var.subnet_cidr
gateway_ip = cidrhost(var.subnet_cidr, -2)
ip_version = 4
dns_nameservers = var.dns_nameservers
allocation_pool {
start = cidrhost(var.subnet_cidr, 1)
end = cidrhost(var.subnet_cidr, -var.instance_count - 3)
}
}
resource "openstack_networking_router_v2" "router" {
name = "tp-router"
admin_state_up = true
external_network_id = data.openstack_networking_network_v2.dmz_net.id
}
resource "openstack_networking_router_interface_v2" "router_interface" {
router_id = openstack_networking_router_v2.router.id
subnet_id = openstack_networking_subnet_v2.tp_subnet.id
}