Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install the latest Terraform version #7

Merged
merged 2 commits into from
Oct 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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