In this article, We are going to perform, How to Install Terraform on CentOS 7/8 LTS or any Cloud Instance like Amazon EC2, Azure VM, Google Compute Engine,etc. with preinstalled CentOS.
Terraform is free and open source Infrastructure automation tool by Hashicorp which is used to create, build and change using infrastructure as a code across various cloud Providers like AWS, Microsoft Azure, GCP, etc.,
- CentOS with Minimal Installation
- 2 CPU and 4 GB RAM
Update the system packages
$ sudo yum update
Install the wget and unzip package to download and extract terraform setup
$ sudo yum install wget unzip -y
How to Install Terraform on CentOS
First download the latest terraform setup from Terraform Official Site using wget.
$ sudo wget https://releases.hashicorp.com/terraform/0.12.26/terraform_0.12.26_linux_amd64.zip
https://releases.hashicorp.com/terraform/0.12.26/terraform_0.12.26_linux_amd64.zip Resolving releases.hashicorp.com (releases.hashicorp.com)... 126.96.36.199, 2a04:4e42:24::439 Connecting to releases.hashicorp.com (releases.hashicorp.com)|188.8.131.52|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 16838433 (16M) [application/zip] Saving to: ‘terraform_0.12.26_linux_amd64.zip’ terraform_0.12.26_linux_amd64.zip 100%[==============================================================================>] 16.06M --.-KB/s in 0.1s (150 MB/s) - ‘terraform_0.12.26_linux_amd64.zip’ saved [16838433/16838433]
Extract the downloaded setup using unzip
$ sudo unzip terraform_0.12.26_linux_amd64.zip
Archive: terraform_0.12.26_linux_amd64.zip inflating: terraform
Move the extracted setup to /usr/local/bin directory
$ sudo mv terraform /usr/local/bin/
$ terraform -v
So we have performed How to Install Terraform on CentOS.
Lets check terraform commands
terraform Usage: terraform [-version] [-help] <command> [args] The available commands for execution are listed below. The most common, useful commands are shown first, followed by less common or more advanced commands. If you're just getting started with Terraform, stick with the common commands. For the other commands, please read the help and docs before usage. Common commands: apply Builds or changes infrastructure console Interactive console for Terraform interpolations destroy Destroy Terraform-managed infrastructure env Workspace management fmt Rewrites config files to canonical format get Download and install modules for the configuration graph Create a visual graph of Terraform resources import Import existing infrastructure into Terraform init Initialize a Terraform working directory login Obtain and save credentials for a remote host logout Remove locally-stored credentials for a remote host output Read an output from a state file plan Generate and show an execution plan providers Prints a tree of the providers used in the configuration refresh Update local state file against real resources show Inspect Terraform state or plan taint Manually mark a resource for recreation untaint Manually unmark a resource as tainted validate Validates the Terraform files version Prints the Terraform version workspace Workspace management All other commands: 0.12upgrade Rewrites pre-0.12 module source code for v0.12 debug Debug output management (experimental) force-unlock Manually unlock the terraform state push Obsolete command for Terraform Enterprise legacy (v1) state Advanced state management
In this article, We have Covered How to Install Terraform on CentOS 7/8, configured terraform, check terraform version and Terraform Commands.