Created
July 27, 2019 22:06
-
-
Save slamdev/2ec6b3d04e1fb47a71e442d76bbf62ef to your computer and use it in GitHub Desktop.
Download latest terragrunt binary
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
#!/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