Use consistent naming of remote provision steps
# 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",
]
}
