Terraform provides binaries that can be downloaded from https://www.terraform.io/downloads. Linux binaries are pre-compiled for the following architectures:
- 386
- Amd64
- Arm
- Arm64
To find out your architecture use:
$ uname -m
x86_64
x86_64
This means we're running on Amd64 architecture and so the binary we'll download is https://releases.hashicorp.com/terraform/M.m.r/terraform_M.m.r_linux_amd64.zip where M.m.r is the latest version. This version can be extracted from Terraform git repository tag:
$ TER_VER=`curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | grep tag_name | cut -d: -f2 | tr -d \"\,\v | awk '{$1=$1};1'`
This is the latest Terraform version at the time of writing:
$ echo $TER_VER
1.1.7
1.1.7
We can use this variable in the following commands which download and unpack the archive and move the binary into bin directory accessible to all users on this machine:
$ wget https://releases.hashicorp.com/terraform/${TER_VER}/terraform_${TER_VER}_linux_amd64.zip
$ unzip terraform_${TER_VER}_linux_amd64.zip
$ sudo mv terraform /usr/local/bin/
To test the installation:
$ terraform -v
Terraform v1.1.7
on linux_amd64
Terraform v1.1.7
on linux_amd64
We can now delete the archive:
$ rm terraform_${TER_VER}_linux_amd64.zip
No comments:
Post a Comment