2023-06-21 12:41:43 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# // Software Name : AWSTerraformStarterKit
|
|
|
|
# // SPDX-FileCopyrightText: Copyright (c) 2023 Orange Business
|
|
|
|
# // SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# //
|
|
|
|
# // This software is distributed under the BSD License;
|
|
|
|
# // see the LICENSE file for more details.
|
|
|
|
# //
|
|
|
|
# // Author: AWS Practice Team <awspractice.core@orange.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
set -o errexit -o nounset -o pipefail
|
|
|
|
|
|
|
|
# Set Starterkit version
|
2023-06-24 04:27:31 +00:00
|
|
|
STARTER_KIT_VERSION="${1:-latest}"
|
2023-06-24 05:52:07 +00:00
|
|
|
STARTER_KIT_PROJECT="${2:-Orange-OpenSource/AWSTerraformStarterKit}"
|
2023-06-21 12:41:43 +00:00
|
|
|
|
2023-06-25 08:24:50 +00:00
|
|
|
STARTER_KIT_FORMAT="tar"
|
|
|
|
STARTER_KIT_URL="https://api.github.com/repos/${STARTER_KIT_PROJECT}"
|
|
|
|
STARTER_KIT_LOCATION="${STARTER_KIT_URL}/${STARTER_KIT_FORMAT}ball/${STARTER_KIT_VERSION}"
|
2023-06-22 08:29:37 +00:00
|
|
|
|
2023-06-25 08:24:02 +00:00
|
|
|
if [ "$STARTER_KIT_VERSION" == "latest" ]; then
|
2023-06-25 08:24:50 +00:00
|
|
|
STARTER_KIT_LOCATION=$(curl -s ${STARTER_KIT_URL}/releases/latest | jq -r ".${STARTER_KIT_FORMAT}ball_url")
|
2023-06-22 08:29:37 +00:00
|
|
|
fi
|
2023-06-21 12:41:43 +00:00
|
|
|
|
2023-06-25 08:24:50 +00:00
|
|
|
curl --fail -L "${STARTER_KIT_LOCATION}" | tar -xz --strip-components 1
|