2017-12-05 20:48:47 +08:00
|
|
|
resource "openstack_networking_router_v2" "k8s" {
|
2018-02-23 14:41:19 +08:00
|
|
|
name = "${var.cluster_name}-router"
|
2018-10-19 18:39:34 +08:00
|
|
|
count = "${var.use_neutron}"
|
2018-02-23 14:41:19 +08:00
|
|
|
admin_state_up = "true"
|
|
|
|
external_network_id = "${var.external_net}"
|
2017-12-05 20:48:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_networking_network_v2" "k8s" {
|
|
|
|
name = "${var.network_name}"
|
2018-10-19 18:39:34 +08:00
|
|
|
count = "${var.use_neutron}"
|
2017-12-05 20:48:47 +08:00
|
|
|
admin_state_up = "true"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_networking_subnet_v2" "k8s" {
|
|
|
|
name = "${var.cluster_name}-internal-network"
|
2018-10-19 18:39:34 +08:00
|
|
|
count = "${var.use_neutron}"
|
2017-12-05 20:48:47 +08:00
|
|
|
network_id = "${openstack_networking_network_v2.k8s.id}"
|
2018-06-15 00:40:32 +08:00
|
|
|
cidr = "${var.subnet_cidr}"
|
2017-12-05 20:48:47 +08:00
|
|
|
ip_version = 4
|
|
|
|
dns_nameservers = "${var.dns_nameservers}"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_networking_router_interface_v2" "k8s" {
|
2018-10-19 18:39:34 +08:00
|
|
|
count = "${var.use_neutron}"
|
2017-12-05 20:48:47 +08:00
|
|
|
router_id = "${openstack_networking_router_v2.k8s.id}"
|
|
|
|
subnet_id = "${openstack_networking_subnet_v2.k8s.id}"
|
|
|
|
}
|