Skip to content

Instantly share code, notes, and snippets.

@holly
Last active May 6, 2023 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holly/cf28b7901cad1a1f9d38ca2012678d32 to your computer and use it in GitHub Desktop.
Save holly/cf28b7901cad1a1f9d38ca2012678d32 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
if [[ -z "$TF_VERSION" ]]; then
TF_VERSION=1.4.6
fi
DOWNLOAD_URL="https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip"
WORK_DIR=$HOME
INSTALL_DIR=$HOME/.local/bin
if [[ ! -d $INSTALL_DIR ]]; then
mkdir -p $INSTALL_DIR
fi
cd $WORK_DIR
curl -sfLO $DOWNLOAD_URL
unzip "terraform_${TF_VERSION}_linux_amd64.zip"
mv terraform $INSTALL_DIR
rm "terraform_${TF_VERSION}_linux_amd64.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment