Make starterkit GitHub project configurable in get-starter-kit.sh

This commit is contained in:
Sébastien Masset 2023-06-24 07:52:07 +02:00
parent 7063a9a3b8
commit eb0066e3e3

View file

@ -15,16 +15,17 @@ set -o errexit -o nounset -o pipefail
# Set Starterkit version
STARTER_KIT_VERSION="${1:-latest}"
STARTER_KIT_PROJECT="${2:-Orange-OpenSource/AWSTerraformStarterKit}"
if [ "$STARTER_KIT_VERSION" == "latest" ]; then
LOCATION=$(curl -s https://api.github.com/repos/Orange-OpenSource/AWSTerraformStarterKit/releases/latest \
LOCATION=$(curl -s "https://api.github.com/repos/${STARTER_KIT_PROJECT}/releases/latest \
| grep "tag_name" \
| awk '{print "https://github.com/Orange-OpenSource/AWSTerraformStarterKit/archive/" substr($2, 2, length($2)-3) ".zip"}') \
| awk '{print "https://github.com/${STARTER_KIT_PROJECT}/archive/" substr($2, 2, length($2)-3) ".zip"}') \
; curl -L -o /tmp/archive.zip "$LOCATION"
else
curl -L\
"https://github.com/Orange-OpenSource/AWSTerraformStarterKit/archive/refs/tags/${STARTER_KIT_VERSION}.zip" \
"https://github.com/${STARTER_KIT_PROJECT}/archive/refs/tags/${STARTER_KIT_VERSION}.zip" \
-o /tmp/archive.zip
fi