From 6676484490ae70753045aeeaef4939c4d18a9803 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Wed, 6 Jun 2018 23:48:37 -0700 Subject: [PATCH] Partially revert b7ed6e7bd35cee39a3f65b47e731938c3006b5cd * Fix change that broke Google Cloud container-linux and fedora-atomic https://github.com/poseidon/typhoon/pull/224 --- .../container-linux/kubernetes/controllers.tf | 16 ++++++++-------- .../fedora-atomic/kubernetes/controllers.tf | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/google-cloud/container-linux/kubernetes/controllers.tf b/google-cloud/container-linux/kubernetes/controllers.tf index 036e4fb9..a3d28c79 100644 --- a/google-cloud/container-linux/kubernetes/controllers.tf +++ b/google-cloud/container-linux/kubernetes/controllers.tf @@ -71,7 +71,7 @@ data "template_file" "controller_config" { etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}" # etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,... - etcd_initial_cluster = "${join(",", data.template_file.etcds.*.rendered)}" + etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", null_resource.repeat.*.triggers.name, null_resource.repeat.*.triggers.domain))}" kubeconfig = "${indent(10, module.bootkube.kubeconfig)}" ssh_authorized_key = "${var.ssh_authorized_key}" @@ -80,14 +80,14 @@ data "template_file" "controller_config" { } } -data "template_file" "etcds" { - count = "${var.controller_count}" - template = "etcd$${index}=https://$${cluster_name}-etcd$${index}.$${dns_zone}:2380" +# Horrible hack to generate a Terraform list of a desired length without dependencies. +# Ideal ${repeat("etcd", 3) -> ["etcd", "etcd", "etcd"]} +resource null_resource "repeat" { + count = "${var.controller_count}" - vars { - index = "${count.index}" - cluster_name = "${var.cluster_name}" - dns_zone = "${var.dns_zone}" + triggers { + name = "etcd${count.index}" + domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}" } } diff --git a/google-cloud/fedora-atomic/kubernetes/controllers.tf b/google-cloud/fedora-atomic/kubernetes/controllers.tf index ad86345f..fe1f596d 100644 --- a/google-cloud/fedora-atomic/kubernetes/controllers.tf +++ b/google-cloud/fedora-atomic/kubernetes/controllers.tf @@ -71,7 +71,7 @@ data "template_file" "controller-cloudinit" { etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}" # etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,... - etcd_initial_cluster = "${join(",", data.template_file.etcds.*.rendered)}" + etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", null_resource.repeat.*.triggers.name, null_resource.repeat.*.triggers.domain))}" kubeconfig = "${indent(6, module.bootkube.kubeconfig)}" ssh_authorized_key = "${var.ssh_authorized_key}" @@ -80,13 +80,13 @@ data "template_file" "controller-cloudinit" { } } -data "template_file" "etcds" { - count = "${var.controller_count}" - template = "etcd$${index}=https://$${cluster_name}-etcd$${index}.$${dns_zone}:2380" +# Horrible hack to generate a Terraform list of a desired length without dependencies. +# Ideal ${repeat("etcd", 3) -> ["etcd", "etcd", "etcd"]} +resource null_resource "repeat" { + count = "${var.controller_count}" - vars { - index = "${count.index}" - cluster_name = "${var.cluster_name}" - dns_zone = "${var.dns_zone}" + triggers { + name = "etcd${count.index}" + domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}" } }