-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPC2.tf
29 lines (25 loc) · 1.15 KB
/
PC2.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
// Private network create via ovh provider
data "openstack_networking_network_v2" "ntwk2" {
depends_on = [ovh_cloud_project_network_private.vlan-ntwk2]
for_each = var.available_region
region = each.key
provider = openstack.PC2
name = "ntwk2"
}
resource "openstack_networking_subnet_v2" "ntwk2" {
for_each = var.available_region
region = each.key
provider = openstack.PC2
name = "ntwk2"
description = "tenant network ntwk2"
network_id = data.openstack_networking_network_v2.ntwk2[each.key].id
cidr = var.tenant_network["ntwk2"].cidr
allocation_pool {
# avoid 0 host, ip 1 is for router gw interface, so start at ip 10 to keep space
start = cidrhost(cidrsubnet(var.tenant_network["ntwk2"].cidr, var.tenant_network["ntwk2"].cidr_newbits, each.value.offset), 10)
end = cidrhost(cidrsubnet(var.tenant_network["ntwk2"].cidr, var.tenant_network["ntwk2"].cidr_newbits, each.value.offset), -1)
}
enable_dhcp = true
gateway_ip = cidrhost(cidrsubnet(var.tenant_network["ntwk2"].cidr, var.tenant_network["ntwk2"].cidr_newbits, each.value.offset), 1)
dns_nameservers = ["8.8.8.8", "1.1.1.1"]
}