Skip to content

Instantly share code, notes, and snippets.

@phivid
Last active December 2, 2019 23:52
Show Gist options
  • Save phivid/a87881eda1b883d5bddce7a08123ef4f to your computer and use it in GitHub Desktop.
Save phivid/a87881eda1b883d5bddce7a08123ef4f to your computer and use it in GitHub Desktop.
resource "null_resource" "install_autoscaler" {
depends_on = [aws_eks_node_group.example]
triggers = {
autoscaler_conf = tostring(data.template_file.autoscaler.rendered)
albingresscontroller_conf = tostring(data.template_file.albingresscontroller.rendered)
}
provisioner "local-exec" {
command = <<EOT
mkdir /home/terraform/.aws
#
# AWS cli configuration...
#
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -b ~/bin/aws
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl ~/bin/kubectl
echo $PATH | grep ~/bin
export PATH=/home/terraform/bin:~/bin:$PATH
#
# Other AWS cli configuration to communicate with EKS...
#
/home/terraform/bin/kubectl apply -f /home/terraform/autoscaler.yml
/home/terraform/bin/kubectl apply -f /home/terraform/albingresscontroller.yml
EOT
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment