allow pre-existing floating IPs to be specified with k8s_master_fips (#6755)

k8s_master_no_etcd_fips should not be input var
This commit is contained in:
rptaylor
2020-10-11 23:54:47 -07:00
committed by GitHub
parent 4cb5a4f609
commit 07858e8f71
6 changed files with 18 additions and 4 deletions

View File

@@ -4,14 +4,16 @@ resource "null_resource" "dummy_dependency" {
}
}
# If user specifies pre-existing IPs to use in k8s_master_fips, do not create new ones.
resource "openstack_networking_floatingip_v2" "k8s_master" {
count = var.number_of_k8s_masters
count = length(var.k8s_master_fips) > 0 ? 0 : var.number_of_k8s_masters
pool = var.floatingip_pool
depends_on = [null_resource.dummy_dependency]
}
# If user specifies pre-existing IPs to use in k8s_master_fips, do not create new ones.
resource "openstack_networking_floatingip_v2" "k8s_master_no_etcd" {
count = var.number_of_k8s_masters_no_etcd
count = length(var.k8s_master_fips) > 0 ? 0 : var.number_of_k8s_masters_no_etcd
pool = var.floatingip_pool
depends_on = [null_resource.dummy_dependency]
}

View File

@@ -1,9 +1,11 @@
# If k8s_master_fips is already defined as input, keep the same value since new FIPs have not been created.
output "k8s_master_fips" {
value = openstack_networking_floatingip_v2.k8s_master[*].address
value = length(var.k8s_master_fips) > 0 ? var.k8s_master_fips : openstack_networking_floatingip_v2.k8s_master[*].address
}
# If k8s_master_fips is already defined as input, keep the same value since new FIPs have not been created.
output "k8s_master_no_etcd_fips" {
value = openstack_networking_floatingip_v2.k8s_master_no_etcd[*].address
value = length(var.k8s_master_fips) > 0 ? var.k8s_master_fips : openstack_networking_floatingip_v2.k8s_master_no_etcd[*].address
}
output "k8s_node_fips" {

View File

@@ -17,3 +17,5 @@ variable "router_id" {
}
variable "k8s_nodes" {}
variable "k8s_master_fips" {}