Skip to content

Instantly share code, notes, and snippets.

@slamdev
Created July 27, 2019 22:06
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 slamdev/2ec6b3d04e1fb47a71e442d76bbf62ef to your computer and use it in GitHub Desktop.
Save slamdev/2ec6b3d04e1fb47a71e442d76bbf62ef to your computer and use it in GitHub Desktop.
Download latest terragrunt binary
#!/bin/sh
set -e
RELEASES_URL="https://github.com/gruntwork-io/terragrunt/releases"
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)"
BIN_FILE="$TMPDIR/terragrunt"
last_version() {
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" |
rev |
cut -f1 -d'/' |
rev
}
download() {
test -z "$VERSION" && VERSION="$(last_version)"
test -z "$VERSION" && {
echo "Unable to get terragrunt version." >&2
exit 1
}
rm -f "$BIN_FILE"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARC=$([ "$(uname -m)" = "x86_64" ] && echo "amd64" || echo "386")
curl -s -L -o "$BIN_FILE" \
"$RELEASES_URL/download/$VERSION/terragrunt_${OS}_${ARC}"
}
download
chmod +x "${BIN_FILE}"
"${BIN_FILE}" --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment