Created
March 10, 2020 09:18
-
-
Save anakaiti/632f5c71f5643103f20a6531508f84c7 to your computer and use it in GitHub Desktop.
Terraform update script for fish shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function update-terraform --description 'Updates terraform to the latest version' | |
set -l base 'https://releases.hashicorp.com/terraform' | |
set -l ver (curl -s $base/ | grep '<a href="/terraform/' | head -n1 | cut -d'/' -f 3) | |
set -l tmpdir (mktemp -d) | |
wget -O $tmpdir/tf.zip $base/$ver/terraform_"$ver"_linux_amd64.zip | |
unzip $tmpdir/tf.zip -d $tmpdir | |
install $tmpdir/terraform (which terraform) | |
terraform version | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment