From de4d90750e83dd3a1d8aade853811cf4dbf7842a Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Mon, 26 Mar 2018 00:29:57 -0700 Subject: [PATCH] Use consistent naming of remote provision steps --- bare-metal/container-linux/kubernetes/ssh.tf | 17 ++++++++++------- google-cloud/container-linux/kubernetes/ssh.tf | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bare-metal/container-linux/kubernetes/ssh.tf b/bare-metal/container-linux/kubernetes/ssh.tf index db934abd..d25538bf 100644 --- a/bare-metal/container-linux/kubernetes/ssh.tf +++ b/bare-metal/container-linux/kubernetes/ssh.tf @@ -1,5 +1,5 @@ # Secure copy etcd TLS assets and kubeconfig to controllers. Activates kubelet.service -resource "null_resource" "copy-etcd-secrets" { +resource "null_resource" "copy-controller-secrets" { count = "${length(var.controller_names)}" connection { @@ -61,13 +61,13 @@ resource "null_resource" "copy-etcd-secrets" { "sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key", "sudo chown -R etcd:etcd /etc/ssl/etcd", "sudo chmod -R 500 /etc/ssl/etcd", - "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig", + "sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", ] } } # Secure copy kubeconfig to all workers. Activates kubelet.service -resource "null_resource" "copy-kubeconfig" { +resource "null_resource" "copy-worker-secrets" { count = "${length(var.worker_names)}" connection { @@ -84,7 +84,7 @@ resource "null_resource" "copy-kubeconfig" { provisioner "remote-exec" { inline = [ - "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig", + "sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", ] } } @@ -95,13 +95,16 @@ resource "null_resource" "bootkube-start" { # Without depends_on, this remote-exec may start before the kubeconfig copy. # Terraform only does one task at a time, so it would try to bootstrap # while no Kubelets are running. - depends_on = ["null_resource.copy-etcd-secrets", "null_resource.copy-kubeconfig"] + depends_on = [ + "null_resource.copy-controller-secrets", + "null_resource.copy-worker-secrets", + ] connection { type = "ssh" host = "${element(var.controller_domains, 0)}" user = "core" - timeout = "30m" + timeout = "15m" } provisioner "file" { @@ -111,7 +114,7 @@ resource "null_resource" "bootkube-start" { provisioner "remote-exec" { inline = [ - "sudo mv /home/core/assets /opt/bootkube", + "sudo mv $HOME/assets /opt/bootkube", "sudo systemctl start bootkube", ] } diff --git a/google-cloud/container-linux/kubernetes/ssh.tf b/google-cloud/container-linux/kubernetes/ssh.tf index c1991bfd..52f4a343 100644 --- a/google-cloud/container-linux/kubernetes/ssh.tf +++ b/google-cloud/container-linux/kubernetes/ssh.tf @@ -1,6 +1,6 @@ # Secure copy etcd TLS assets to controllers. resource "null_resource" "copy-controller-secrets" { - count = "${var.controller_count}" + count = "${var.controller_count}" connection { type = "ssh"