Last active
April 25, 2020 06:52
-
-
Save HammoTime/4543b2a2c3a2a87535afd9a9228066f7 to your computer and use it in GitHub Desktop.
Installs the current version of terraform on Debian-based Linux distributions.
This file contains hidden or 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
sudo apt install -y jq wget unzip | |
cd ~ | |
version=$(curl https://api.github.com/repos/hashicorp/terraform/releases/latest --silent | jq ".tag_name" -r) | |
version=$(echo $version | sed 's/v//g') # get rid of 'v' from version number | |
echo "Installing Terraform $version." | |
url="https://releases.hashicorp.com/terraform/$version/terraform_$(echo $version)_linux_amd64.zip" | |
wget $url | |
unzip "terraform_$(echo $version)_linux_amd64.zip" | |
chmod +x terraform | |
sudo mv terraform /usr/local/bin/ | |
echo "Terraform $version installed." | |
rm "terraform_$(echo $version)_linux_amd64.zip" | |
echo "Install files cleaned up." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment