Skip to content

Instantly share code, notes, and snippets.

@franzramadhan
Created February 26, 2019 08:04
Show Gist options
  • Save franzramadhan/0d4ae8e7673d89bede8120ad26b626db to your computer and use it in GitHub Desktop.
Save franzramadhan/0d4ae8e7673d89bede8120ad26b626db to your computer and use it in GitHub Desktop.
Download Hashicorp Packages
#!/bin/bash
set -ex
TF_VERSION="0.11.11"
NOMAD_VERSION="0.8.7"
CONSUL_VERSION="1.4.2"
VAULT_VERSION="1.0.3"
PACKER_VERSION="1.3.4"
VERSION=""
declare -a hashicorps=( "terraform" "nomad" "consul" "vault" "packer" )
for hashicorp in ${hashicorps[@]};do
case ${hashicorp} in
terraform)
VERSION=${TF_VERSION}
;;
nomad)
VERSION=${NOMAD_VERSION}
;;
consul)
VERSION=${CONSUL_VERSION}
;;
vault)
VERSION=${VAULT_VERSION}
;;
packer)
VERSION=${PACKER_VERSION}
;;
*) echo "env VERSION is not set"
;;
esac
curl -s https://releases.hashicorp.com/${hashicorp}/${VERSION}/${hashicorp}_${VERSION}_linux_amd64.zip -o /tmp/${hashicorp}.zip
mkdir -p ${HOME}/hashicorp/bin && unzip -o /tmp/${hashicorp}.zip -d ${HOME}/hashicorp/bin/ && rm -f /tmp/${hashicorp}.zip
done
echo "PATH=\$PATH:\$HOME/hashicorp/bin" | tee -a ~/.bashrc ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment