Avoid creating extraneous GCE controller instance groups

* Intended as part of #504 improvement
* Single controller clusters only require one controller
instance group (previously created zone-many)
* Multi-controller clusters must "wrap" controllers over
zonal heterogeneous instance groups. For example, 5
controllers over 3 zones (no change)
This commit is contained in:
Dalton Hubble 2019-07-20 16:51:29 -07:00
parent e0c7676a15
commit 56d0b9eae4

View File

@ -57,7 +57,7 @@ resource "google_compute_backend_service" "apiserver" {
# Instance group of heterogeneous (unmanged) controller instances
resource "google_compute_instance_group" "controllers" {
count = length(local.zones)
count = min(var.controller_count, length(local.zones))
name = format("%s-controllers-%s", var.cluster_name, element(local.zones, count.index))
zone = element(local.zones, count.index)