-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path11.fetch-files.tf
37 lines (27 loc) · 1.42 KB
/
11.fetch-files.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
resource "null_resource" "fetch_files" {
provisioner "local-exec" {
command = <<-EOC
## --- Fetch 'kubeadm join' scripts. ---
chmod 400 ${path.module}/outputs/private-key.pem
rm -rf ${path.module}/outputs/kubeadm-join.as-master.sh ${path.module}/outputs/kubeadm-join.as-worker.sh
scp \
-i ${path.module}/outputs/private-key.pem \
-o "ProxyCommand ssh ubuntu@${aws_instance.bastian_host.public_ip} -W %h:%p -i ${path.module}/outputs/private-key.pem" \
ubuntu@${aws_instance.master_nodes[0].private_ip}:kubeadm-join.as-master.sh \
${path.module}/outputs/kubeadm-join.as-master.sh
scp \
-i ${path.module}/outputs/private-key.pem \
-o "ProxyCommand ssh ubuntu@${aws_instance.bastian_host.public_ip} -W %h:%p -i ${path.module}/outputs/private-key.pem" \
ubuntu@${aws_instance.master_nodes[0].private_ip}:kubeadm-join.as-worker.sh \
${path.module}/outputs/kubeadm-join.as-worker.sh
rm ${path.module}/outputs/temp.txt
## --- Fetch 'kubeconfig.yaml' file. ---
scp \
-i ${path.module}/outputs/private-key.pem \
-o "ProxyCommand ssh ubuntu@${aws_instance.bastian_host.public_ip} -W %h:%p -i ${path.module}/outputs/private-key.pem" \
ubuntu@${aws_instance.master_nodes[0].private_ip}:.kube/config \
${path.module}/outputs/kubeconfig.yaml
EOC
}
depends_on = [null_resource.bootstrap_cluster]
}