How to install or Update Terraform in Linux on AWS
How to install or Update Terraform in Linux on AWS
Terraform is distributed as a binary package for all supported platforms and architectures.
We need to find out the terraform packages here and download it. Terraform is packaged as a zip archive.
Terraform latest version is "1.0.2". If you need to install older version, you can download it from here.
Prerequisites:
wget and unzip tool should be installed in your system. If you don’t have then you install them now.
[root@dockerserver ~]# yum install wget unzip
I've installed v0.12.12 earlier on my AWS centOS 7 host and i'm updating the terraform version now:
[root@dockerserver ~]# terraform version
Terraform v0.12.12
Your version of Terraform is out of date! The latest version
is 0.12.19. You can update by downloading from www.terraform.io/downloads.html
[root@dockerserver ~]
Terraform v0.12.12
Your version of Terraform is out of date! The latest version
is 0.12.19. You can update by downloading from www.terraform.io/downloads.html
[root@dockerserver ~]
Download the newer version:
[root@dockerserver ~]# wget https://releases.hashicorp.com/terraform/0.12.19/terraform_0.12.19_linux_amd64.zip
--2020-01-20 11:17:11-- https://releases.hashicorp.com/terraform/0.12.19/terraform_0.12.19_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.153.183, 2a04:4e42:42::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.153.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16530635 (16M) [application/zip]
Saving to: ‘terraform_0.12.19_linux_amd64.zip’
100%[======================================================================================>] 16,530,635 --.-K/s in 0.07s
2020-01-20 11:17:11 (211 MB/s) - ‘terraform_0.12.19_linux_amd64.zip’ saved [16530635/16530635]
[root@dockerserver ~]#
--2020-01-20 11:17:11-- https://releases.hashicorp.com/terraform/0.12.19/terraform_0.12.19_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.153.183, 2a04:4e42:42::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.153.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16530635 (16M) [application/zip]
Saving to: ‘terraform_0.12.19_linux_amd64.zip’
100%[======================================================================================>] 16,530,635 --.-K/s in 0.07s
2020-01-20 11:17:11 (211 MB/s) - ‘terraform_0.12.19_linux_amd64.zip’ saved [16530635/16530635]
[root@dockerserver ~]#
After downloading Terraform, unzip the package. Terraform runs as a single binary named terraform.
[root@dockerserver ~]# unzip terraform_0.12.19_linux_amd64.zip
Archive: terraform_0.12.19_linux_amd64.zip
replace terraform? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: terraform
[root@dockerserver ~]#
Archive: terraform_0.12.19_linux_amd64.zip
replace terraform? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: terraform
[root@dockerserver ~]#
Now copy the terraform binary to "/usr/local/bin/"
[root@dockerserver ~]# cp -pr terraform /usr/local/bin/
cp: overwrite ‘/usr/local/bin/terraform’? y
[root@dockerserver ~]#
Now check the terraform version. Its updated now.cp: overwrite ‘/usr/local/bin/terraform’? y
[root@dockerserver ~]#
[root@dockerserver ~]# terraform version
Terraform v0.12.19
[root@dockerserver ~]#
Terraform v0.12.19
[root@dockerserver ~]#
No comments