Install Terraform

Install
Terraform

Terraform is distributed as a binary for almost all platforms [Windows, Linux, Mac ]. You can use various methods of installing and they are all explained in detail on the Terraform website in the file download location.

If you wish to run Terraform on your laptop, versions available for Mac/Windows can easily be installed, but keeping a Terraform infrastructure running from a mobile laptop that is less secure is not a good idea.

Step 1 - Install Terraform.

You will be using the Linux AMD64 version for this particular deployment. For this lab we are going to pull from one of our servers and install it on this Linux virtual machine directly. This is to insure that the instructions work with this specific version of Terraform.


cd ~
wget https://svs-rtp-dmz-files.ciscolive.com/terra-lab/terraform_0.12.29_linux_amd64.zip

Now you need to unzip the downloaded file and extracted to the user bin folder. Terraform doesn't need to be installed as a super-user program and can be run this way in platforms like MacOS. Once this is done, the executable for terraform will be available in the path for easy execution as we have already added this location to this accounts path.


unzip terraform_0.12.29_linux_amd64.zip -d ~/bin/

The executable is called terraform. Now you can verify the version of Terraform and that it is runnnig properly:


terraform --version

labuser@terra-vm-pod03:~#  terraform --version
Terraform v0.12.29

Step 2 - Configure BASH autocomplete for Terraform

With auto-complete you can then use TAB for various commands related to terraform.


cd ~
terraform -install-autocomplete
. .bashrc

Now if you type terraform and press TAB it will list available commands.


labuser@terra-vm-pod03:~# # terraform
0.12upgrade debug fmt graph internal-plugin output push state validate
apply destroy force-unlock import login plan refresh taint version
console env get init logout providers show untaint workspace