Render etcd_initial_cluster using a template_file
This commit is contained in:
parent
4ac4d7cbaf
commit
6a581ab577
|
@ -54,7 +54,7 @@ data "template_file" "controller_config" {
|
||||||
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
||||||
|
|
||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", null_resource.repeat.*.triggers.name, null_resource.repeat.*.triggers.domain))}"
|
etcd_initial_cluster = "${join(",", data.template_file.etcds.*.rendered)}"
|
||||||
|
|
||||||
kubeconfig = "${indent(10, module.bootkube.kubeconfig)}"
|
kubeconfig = "${indent(10, module.bootkube.kubeconfig)}"
|
||||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||||
|
@ -63,14 +63,14 @@ data "template_file" "controller_config" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Horrible hack to generate a Terraform list of a desired length without dependencies.
|
data "template_file" "etcds" {
|
||||||
# Ideal ${repeat("etcd", 3) -> ["etcd", "etcd", "etcd"]}
|
|
||||||
resource null_resource "repeat" {
|
|
||||||
count = "${var.controller_count}"
|
count = "${var.controller_count}"
|
||||||
|
template = "etcd$${index}=https://$${cluster_name}-etcd$${index}.$${dns_zone}:2380"
|
||||||
|
|
||||||
triggers {
|
vars {
|
||||||
name = "etcd${count.index}"
|
index = "${count.index}"
|
||||||
domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
cluster_name = "${var.cluster_name}"
|
||||||
|
dns_zone = "${var.dns_zone}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ data "template_file" "controller-cloudinit" {
|
||||||
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
||||||
|
|
||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", null_resource.repeat.*.triggers.name, null_resource.repeat.*.triggers.domain))}"
|
etcd_initial_cluster = "${join(",", data.template_file.etcds.*.rendered)}"
|
||||||
|
|
||||||
kubeconfig = "${indent(6, module.bootkube.kubeconfig)}"
|
kubeconfig = "${indent(6, module.bootkube.kubeconfig)}"
|
||||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||||
|
@ -63,13 +63,13 @@ data "template_file" "controller-cloudinit" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Horrible hack to generate a Terraform list of a desired length without dependencies.
|
data "template_file" "etcds" {
|
||||||
# Ideal ${repeat("etcd", 3) -> ["etcd", "etcd", "etcd"]}
|
|
||||||
resource null_resource "repeat" {
|
|
||||||
count = "${var.controller_count}"
|
count = "${var.controller_count}"
|
||||||
|
template = "etcd$${index}=https://$${cluster_name}-etcd$${index}.$${dns_zone}:2380"
|
||||||
|
|
||||||
triggers {
|
vars {
|
||||||
name = "etcd${count.index}"
|
index = "${count.index}"
|
||||||
domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
cluster_name = "${var.cluster_name}"
|
||||||
|
dns_zone = "${var.dns_zone}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,20 +69,20 @@ data "template_file" "controller_config" {
|
||||||
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
||||||
|
|
||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", null_resource.repeat.*.triggers.name, null_resource.repeat.*.triggers.domain))}"
|
etcd_initial_cluster = "${join(",", data.template_file.etcds.*.rendered)}"
|
||||||
k8s_dns_service_ip = "${cidrhost(var.service_cidr, 10)}"
|
k8s_dns_service_ip = "${cidrhost(var.service_cidr, 10)}"
|
||||||
cluster_domain_suffix = "${var.cluster_domain_suffix}"
|
cluster_domain_suffix = "${var.cluster_domain_suffix}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Horrible hack to generate a Terraform list of a desired length without dependencies.
|
data "template_file" "etcds" {
|
||||||
# Ideal ${repeat("etcd", 3) -> ["etcd", "etcd", "etcd"]}
|
|
||||||
resource null_resource "repeat" {
|
|
||||||
count = "${var.controller_count}"
|
count = "${var.controller_count}"
|
||||||
|
template = "etcd$${index}=https://$${cluster_name}-etcd$${index}.$${dns_zone}:2380"
|
||||||
|
|
||||||
triggers {
|
vars {
|
||||||
name = "etcd${count.index}"
|
index = "${count.index}"
|
||||||
domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
cluster_name = "${var.cluster_name}"
|
||||||
|
dns_zone = "${var.dns_zone}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ data "template_file" "controller-cloudinit" {
|
||||||
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
||||||
|
|
||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", null_resource.repeat.*.triggers.name, null_resource.repeat.*.triggers.domain))}"
|
etcd_initial_cluster = "${join(",", data.template_file.etcds.*.rendered)}"
|
||||||
|
|
||||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||||
k8s_dns_service_ip = "${cidrhost(var.service_cidr, 10)}"
|
k8s_dns_service_ip = "${cidrhost(var.service_cidr, 10)}"
|
||||||
|
@ -77,13 +77,13 @@ data "template_file" "controller-cloudinit" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Horrible hack to generate a Terraform list of a desired length without dependencies.
|
data "template_file" "etcds" {
|
||||||
# Ideal ${repeat("etcd", 3) -> ["etcd", "etcd", "etcd"]}
|
|
||||||
resource null_resource "repeat" {
|
|
||||||
count = "${var.controller_count}"
|
count = "${var.controller_count}"
|
||||||
|
template = "etcd$${index}=https://$${cluster_name}-etcd$${index}.$${dns_zone}:2380"
|
||||||
|
|
||||||
triggers {
|
vars {
|
||||||
name = "etcd${count.index}"
|
index = "${count.index}"
|
||||||
domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
cluster_name = "${var.cluster_name}"
|
||||||
|
dns_zone = "${var.dns_zone}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ data "template_file" "controller_config" {
|
||||||
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
||||||
|
|
||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", null_resource.repeat.*.triggers.name, null_resource.repeat.*.triggers.domain))}"
|
etcd_initial_cluster = "${join(",", data.template_file.etcds.*.rendered)}"
|
||||||
|
|
||||||
kubeconfig = "${indent(10, module.bootkube.kubeconfig)}"
|
kubeconfig = "${indent(10, module.bootkube.kubeconfig)}"
|
||||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||||
|
@ -80,14 +80,14 @@ data "template_file" "controller_config" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Horrible hack to generate a Terraform list of a desired length without dependencies.
|
data "template_file" "etcds" {
|
||||||
# Ideal ${repeat("etcd", 3) -> ["etcd", "etcd", "etcd"]}
|
|
||||||
resource null_resource "repeat" {
|
|
||||||
count = "${var.controller_count}"
|
count = "${var.controller_count}"
|
||||||
|
template = "etcd$${index}=https://$${cluster_name}-etcd$${index}.$${dns_zone}:2380"
|
||||||
|
|
||||||
triggers {
|
vars {
|
||||||
name = "etcd${count.index}"
|
index = "${count.index}"
|
||||||
domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
cluster_name = "${var.cluster_name}"
|
||||||
|
dns_zone = "${var.dns_zone}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ data "template_file" "controller-cloudinit" {
|
||||||
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
etcd_domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
||||||
|
|
||||||
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
# etcd0=https://cluster-etcd0.example.com,etcd1=https://cluster-etcd1.example.com,...
|
||||||
etcd_initial_cluster = "${join(",", formatlist("%s=https://%s:2380", null_resource.repeat.*.triggers.name, null_resource.repeat.*.triggers.domain))}"
|
etcd_initial_cluster = "${join(",", data.template_file.etcds.*.rendered)}"
|
||||||
|
|
||||||
kubeconfig = "${indent(6, module.bootkube.kubeconfig)}"
|
kubeconfig = "${indent(6, module.bootkube.kubeconfig)}"
|
||||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||||
|
@ -80,13 +80,13 @@ data "template_file" "controller-cloudinit" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Horrible hack to generate a Terraform list of a desired length without dependencies.
|
data "template_file" "etcds" {
|
||||||
# Ideal ${repeat("etcd", 3) -> ["etcd", "etcd", "etcd"]}
|
|
||||||
resource null_resource "repeat" {
|
|
||||||
count = "${var.controller_count}"
|
count = "${var.controller_count}"
|
||||||
|
template = "etcd$${index}=https://$${cluster_name}-etcd$${index}.$${dns_zone}:2380"
|
||||||
|
|
||||||
triggers {
|
vars {
|
||||||
name = "etcd${count.index}"
|
index = "${count.index}"
|
||||||
domain = "${var.cluster_name}-etcd${count.index}.${var.dns_zone}"
|
cluster_name = "${var.cluster_name}"
|
||||||
|
dns_zone = "${var.dns_zone}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue