Advertisement
redhottsili

terraform_install

May 27th, 2025 (edited)
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/bin/bash
  2. if [[ -z "${1}" ]]; then
  3.   VERSION=$(
  4.     jq -r '. | sort_by(.created_at) | reverse | map(.tag_name) | map(select(. | test("-.+$") | not)) | first' <<< $(
  5.       curl -s https://api.github.com/repos/hashicorp/terraform/releases
  6.     )
  7.   )
  8. else
  9.   VERSION="${1}"
  10. fi
  11.  
  12. wget -q "https://releases.hashicorp.com/terraform/${VERSION}/terraform_${VERSION}_linux_amd64.zip"
  13. unzip "terraform_${VERSION}_linux_amd64.zip" 1>/dev/null
  14. rm LICENSE.txt "terraform_${VERSION}_linux_amd64.zip" 1>/dev/null
  15. mv terraform /usr/local/bin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement