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