Install Terraform on CentOS 7

Terraform is an automation software which allows you to manage infrastructure resources from code efficiently. It allows you to manage any cloud environment like aws, gcp, azure etc. You can use Terraform to build, change, and version infrastructure deployed on proprietary cloud providers or your own infrastructure on premises.

Terraform is distributed as a binary package for all supported platforms and architectures.

Install

Installation is preety straight forward. Simply, download, unzip and use it.

[root@db02 ~]# wget https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_linux_amd64.zip
--2019-05-22 18:46:59--  https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_linux_amd64.zip
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.1.183, 151.101.65.183, 151.101.129.183, ...
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.1.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12569267 (12M) [application/zip]
Saving to: ‘terraform_0.11.14_linux_amd64.zip’

100%[=================================================================================================================>] 12,569,267  1.51MB/s   in 7.8s

2019-05-22 18:47:07 (1.55 MB/s) - ‘terraform_0.11.14_linux_amd64.zip’ saved [12569267/12569267]

[root@db02 ~]#

[root@db02 ~]# unzip terraform_0.11.14_linux_amd64.zip
Archive: terraform_0.11.14_linux_amd64.zip
inflating: terraform
[root@db02 ~]# ls -ltrh
total 49M
-rw-------. 1 root root 1.4K Feb 13 20:38 anaconda-ks.cfg
-rwxrwxr-x 1 root root 37M May 17 02:13 terraform
-rw-r--r-- 1 root root 12M May 17 02:14 terraform_0.11.14_linux_amd64.zip
[root@db02 ~]#

[root@db02 ~]# mv terraform /usr/local/bin/
[root@db02 ~]# ls -ltrh /usr/local/bin/
total 37M
-rwxrwxr-x 1 root root 37M May 17 02:13 terraform
[root@db02 ~]#

[root@db02 ~]# terraform --version Terraform v0.11.14 [root@db02 ~]#

Usage

Terraform usage is shown below.

[root@db02 ~]# terraform --help
Usage: terraform [-version] [-help]  [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
    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
    push               Upload this Terraform module to Atlas to run
    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.12checklist      Checks whether the configuration is ready for Terraform v0.12
    debug              Debug output management (experimental)
    force-unlock       Manually unlock the terraform state
    state              Advanced state management
[root@db02 ~]#

Conclusion:

We have successfully setup terraform tool.

Enjoy !!!

Leave a Reply

Your email address will not be published. Required fields are marked *