Skip to content

Instantly share code, notes, and snippets.

@kshcherban
Last active April 23, 2020 19:14
Show Gist options
  • Select an option

  • Save kshcherban/c3b21e9c7caab4aeb3308bf1d267d5e1 to your computer and use it in GitHub Desktop.

Select an option

Save kshcherban/c3b21e9c7caab4aeb3308bf1d267d5e1 to your computer and use it in GitHub Desktop.

Revisions

  1. kshcherban revised this gist Nov 21, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion auto-update-terraform
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    INSTALL_DIR="${1:-/opt/terraform}"
    URL="https://releases.hashicorp.com/terraform"

    VER="$(curl -sL $URL | grep -Po "_(\d*\.?){3}" | sed 's/_//' | sort -V | tail -1)"
    VER="$(curl -sL $URL | grep -v beta | grep -Po "_(\d*\.?){3}" | sed 's/_//' | sort -V | tail -1)"
    ZIP="terraform_${VER}_linux_amd64.zip"

    echo "* Downloading ${URL}/${VER}/terraform_${VER}_linux_amd64.zip"
  2. kshcherban revised this gist Nov 10, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion auto-update-terraform
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,4 @@ ZIP="terraform_${VER}_linux_amd64.zip"
    echo "* Downloading ${URL}/${VER}/terraform_${VER}_linux_amd64.zip"
    curl -s ${URL}/${VER}/terraform_${VER}_linux_amd64.zip -o ${INSTALL_DIR}/${ZIP}
    echo "* Extracting $ZIP into $INSTALL_DIR"
    unzip $ZIP -d $INSTALL_DIR && rm -v $ZIP
    unzip -o ${INSTALL_DIR}/$ZIP -d $INSTALL_DIR && rm -v ${INSTALL_DIR}/$ZIP
  3. kshcherban created this gist Nov 10, 2016.
    12 changes: 12 additions & 0 deletions auto-update-terraform
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash

    INSTALL_DIR="${1:-/opt/terraform}"
    URL="https://releases.hashicorp.com/terraform"

    VER="$(curl -sL $URL | grep -Po "_(\d*\.?){3}" | sed 's/_//' | sort -V | tail -1)"
    ZIP="terraform_${VER}_linux_amd64.zip"

    echo "* Downloading ${URL}/${VER}/terraform_${VER}_linux_amd64.zip"
    curl -s ${URL}/${VER}/terraform_${VER}_linux_amd64.zip -o ${INSTALL_DIR}/${ZIP}
    echo "* Extracting $ZIP into $INSTALL_DIR"
    unzip $ZIP -d $INSTALL_DIR && rm -v $ZIP