Skip to content

Commit

Permalink
Merge pull request #7 from bitops-plugins/enh/use-latest-terraform
Browse files Browse the repository at this point in the history
Install the latest Terraform version
  • Loading branch information
arm4b authored Oct 6, 2022
2 parents b189c2d + 91632e2 commit cbb125c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ echo ""
apk info

# export TERRAFORM_VERSIONS=$(cat build.config.yaml | shyaml get-values terraform.versions)
TERRAFORM_VERSION=1.2.2
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"

if command -v terraform &> /dev/null
then
# Terraform already installed
# 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"
Expand All @@ -35,4 +33,5 @@ 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

0 comments on commit cbb125c

Please sign in to comment.