Conditionally set networkd content on bare-metal
* Without this change, if a cluster doesn't set the controller or worker networkd lists, an err "element() may not be used with an empty list" occurs. * controller_networkds and worker_networks are intended to be optional and temporary, not required at all
This commit is contained in:
parent
43dc44623f
commit
bfa8dfc75d
|
@ -87,7 +87,9 @@ data "template_file" "controller-configs" {
|
|||
etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", var.controller_names, var.controller_domains))}"
|
||||
k8s_dns_service_ip = "${module.bootkube.kube_dns_service_ip}"
|
||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||
networkd_content = "${element(var.controller_networkds, count.index)}"
|
||||
|
||||
# Terraform evaluates both sides regardless and element cannot be used on 0 length lists
|
||||
networkd_content = "${length(var.controller_networkds) == 0 ? "" : element(concat(var.controller_networkds, list("")), count.index)}"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,6 +109,8 @@ data "template_file" "worker-configs" {
|
|||
domain_name = "${element(var.worker_domains, count.index)}"
|
||||
k8s_dns_service_ip = "${module.bootkube.kube_dns_service_ip}"
|
||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||
networkd_content = "${element(var.worker_networkds, count.index)}"
|
||||
|
||||
# Terraform evaluates both sides regardless and element cannot be used on 0 length lists
|
||||
networkd_content = "${length(var.worker_networkds) == 0 ? "" : element(concat(var.worker_networkds, list("")), count.index)}"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue