Skip to content

Instantly share code, notes, and snippets.

@rdalbuquerque
Created June 7, 2021 04:35
Show Gist options
  • Save rdalbuquerque/48fd35b5aba3eb368f8bc14c301ec698 to your computer and use it in GitHub Desktop.
Save rdalbuquerque/48fd35b5aba3eb368f8bc14c301ec698 to your computer and use it in GitHub Desktop.
Terraform resource to fetch kubeconfig from newly created cluster
resource "null_resource" "fetch_kubeconfig" {
provisioner "local-exec" {
command = "scp -i ~/.ssh/k8s-lab.pem admin@${aws_instance.kube_master.public_ip}:~/.kube/config ~/.kube/config && sed -i '/server/c\\ server: https://${aws_instance.kube_master.public_ip}:6443' ~/.kube/config"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment