From 80c5076e76bbe93048e9f78e120c1ee9965f6728 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 14 Aug 2021 16:56:14 +0200 Subject: terraform --- bin/terraform | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'bin/terraform') diff --git a/bin/terraform b/bin/terraform index 06c2a76..249d7ae 100755 --- a/bin/terraform +++ b/bin/terraform @@ -1,25 +1,23 @@ #!/bin/bash set -euo pipefail -#set -x -basedir="$(dirname $0)" +basedir=$(dirname "$0") -terraform_version=0.13.5 -terraform_url=https://releases.hashicorp.com/terraform/$terraform_version/terraform_${terraform_version}_linux_amd64.zip +version=0.14.6 +version=0.13.5 +url=https://releases.hashicorp.com/terraform/${version}/terraform_${version}_linux_amd64.zip -dl_d=$basedir/.terraform/dl -zip_file=$dl_d/terraform-${terraform_version}.zip -unzip_d=$basedir/.terraform/unzip/$terraform_version -cmd=$unzip_d/terraform +bin="$basedir/.tmp/$version/terraform" -if [[ ! -x $cmd ]] +if [[ ! -x "$bin" ]] then - mkdir -p $dl_d - curl -L -o "$zip_file" $terraform_url - rm -rf $unzip_d - mkdir -p $unzip_d - unzip $zip_file -d $unzip_d + mkdir -p $(dirname "$bin") + wget -O "$bin.zip" "$url" + cd $(dirname "$bin") + unzip "$bin.zip" terraform + chmod +x terraform + cd - fi -exec "$cmd" "${@}" +exec "$bin" "${@}" -- cgit v1.2.3