2017-12-05 12:48:47 +00:00
|
|
|
resource "null_resource" "dummy_dependency" {
|
2019-08-18 08:30:05 +00:00
|
|
|
triggers = {
|
2020-06-05 07:05:43 +00:00
|
|
|
dependency_id = var.router_id
|
2017-12-05 12:48:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 06:54:47 +00:00
|
|
|
# If user specifies pre-existing IPs to use in k8s_master_fips, do not create new ones.
|
2017-12-05 12:48:47 +00:00
|
|
|
resource "openstack_networking_floatingip_v2" "k8s_master" {
|
2020-10-12 06:54:47 +00:00
|
|
|
count = length(var.k8s_master_fips) > 0 ? 0 : var.number_of_k8s_masters
|
2020-06-05 07:05:43 +00:00
|
|
|
pool = var.floatingip_pool
|
|
|
|
depends_on = [null_resource.dummy_dependency]
|
2017-12-05 12:48:47 +00:00
|
|
|
}
|
|
|
|
|
2020-10-12 06:54:47 +00:00
|
|
|
# If user specifies pre-existing IPs to use in k8s_master_fips, do not create new ones.
|
2019-04-29 05:58:20 +00:00
|
|
|
resource "openstack_networking_floatingip_v2" "k8s_master_no_etcd" {
|
2020-10-12 06:54:47 +00:00
|
|
|
count = length(var.k8s_master_fips) > 0 ? 0 : var.number_of_k8s_masters_no_etcd
|
2020-06-05 07:05:43 +00:00
|
|
|
pool = var.floatingip_pool
|
|
|
|
depends_on = [null_resource.dummy_dependency]
|
2019-04-29 05:58:20 +00:00
|
|
|
}
|
|
|
|
|
2017-12-05 12:48:47 +00:00
|
|
|
resource "openstack_networking_floatingip_v2" "k8s_node" {
|
2020-06-05 07:05:43 +00:00
|
|
|
count = var.number_of_k8s_nodes
|
|
|
|
pool = var.floatingip_pool
|
|
|
|
depends_on = [null_resource.dummy_dependency]
|
2017-12-05 12:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_networking_floatingip_v2" "bastion" {
|
2020-06-05 07:05:43 +00:00
|
|
|
count = var.number_of_bastions
|
|
|
|
pool = var.floatingip_pool
|
|
|
|
depends_on = [null_resource.dummy_dependency]
|
2017-12-05 12:48:47 +00:00
|
|
|
}
|
2020-04-16 14:52:45 +00:00
|
|
|
|
|
|
|
resource "openstack_networking_floatingip_v2" "k8s_nodes" {
|
|
|
|
for_each = var.number_of_k8s_nodes == 0 ? { for key, value in var.k8s_nodes : key => value if value.floating_ip } : {}
|
2020-06-05 07:05:43 +00:00
|
|
|
pool = var.floatingip_pool
|
|
|
|
depends_on = [null_resource.dummy_dependency]
|
2020-04-16 14:52:45 +00:00
|
|
|
}
|
|
|
|
|