Skip to content

Commit

Permalink
distver.plugin.sh: add terraform_install
Browse files Browse the repository at this point in the history
  • Loading branch information
yousong committed Oct 23, 2024
1 parent 527848d commit b357209
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions data/_usr.env/distver.plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,37 @@ docker_compose_install() {
docker-compose version
}

terraform_install() {
local ver="$1"
local goos goarch
local zipf
local url

if test -z "$ver"; then
ver=1.9.8
__errmsg "Defaulting to version $ver, see the doc for recent details"
__errmsg ""
__errmsg " https://developer.hashicorp.com/terraform/install"
fi
goos="$(go_os)"
goarch="$(go_arch)"
zipf="terraform_${ver}_${goos}_${goarch}.zip"
url="https://releases.hashicorp.com/terraform/${ver}/$zipf"

local tmpd
tmpd="$(mktemp -d terraform_install.XXX)"
(
cd "$tmpd"
mget \
--count 4 \
--url "$url"
unzip "$zipf"
mv terraform "$o_usr_env/bin/terraform"
terraform version
)
rm -rf "$tmpd"
}

docker_buildx_install() {
local goos goarch
local ver
Expand Down

0 comments on commit b357209

Please sign in to comment.