diff --git a/terraform/get-terraform.sh b/terraform/get-terraform.sh index efe1e283..1964b2ff 100755 --- a/terraform/get-terraform.sh +++ b/terraform/get-terraform.sh @@ -10,7 +10,7 @@ ARG=$1 THIS=$(basename $0) -THIS_VERSION="1.0.14" +THIS_VERSION="1.1.0" #VERSION="0.12.8" #test -d terraform || mkdir terraform @@ -93,3 +93,19 @@ then umask 022 cp terraform_${version} $BINDIR/ && ln -sf terraform_${version} $BINDIR/terraform_latest fi +if [[ $ARG == "install" ]] +then + tfbin=$(which terraform_current 2> /dev/null) + if [ ! -z $tfbin ] + then + BINDIR=$(dirname $tfbin) + elif [ -z $BINDIR ] + then + echo "x unable to locate current terraform binary, use BINDIR=path to install" + exit 1 + fi + + echo "* installing terraform $version into $BINDIR/terraform_current" + umask 022 + cp terraform_${version} $BINDIR/ && ln -sf terraform_${version} $BINDIR/terraform_current +fi