-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·37 lines (28 loc) · 1.32 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -e
echo ""
echo "When including a plugin in a BitOps install, this script will be called during docker build."
echo "It should be used to install any dependencies required to actually run your plugin."
echo "BitOps uses alpine linux as its base, so you'll want to use apk commands (Alpine Package Keeper)"
echo ""
apk info
# export TERRAFORM_VERSIONS=$(cat build.config.yaml | shyaml get-values terraform.versions)
LATEST_RELEASE=$(curl https://api.github.com/repos/hashicorp/terraform/releases/latest | jq --raw-output '.tag_name' | cut -c 2-)
TERRAFORM_VERSION=${LATEST_RELEASE}
echo "USING TERRAFORM VERSION: [$TERRAFORM_VERSION]"
mkdir -p /opt/download
cd /opt/download
echo "CD - DOWNLOAD FOLDER"
# Terraform already installed
if command -v terraform &> /dev/null; then
exit
fi
echo "INSTALLING TERRAFORM"
TERRAFORM_DOWNLOAD_URL="https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
echo ${TERRAFORM_DOWNLOAD_URL}
curl -LO ${TERRAFORM_DOWNLOAD_URL} && unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d ./
mv terraform /usr/local/bin/terraform-${TERRAFORM_VERSION}
ln -s /usr/local/bin/terraform-${TERRAFORM_VERSION} /usr/local/bin/terraform
chmod +x /usr/local/bin/terraform-${TERRAFORM_VERSION}
# Verify the Terraform installation
terraform version