How to Install Terraform on Ubuntu 16.04/18.04 LTS

Terraform is an open-source foundation as code, programming instrument made by HashiCorp. It empowers clients to characterize and arrangement server farm foundation utilizing an explanatory setup language known as HashiCorp Configuration Language (HCL), or alternatively JSON.

In this post, We will install and configure Terraform on ubutnu.

 
Click here to install and configure packer with azure cloud.

Download Terraform


To download the terraform by using the following command.

$ cd /tmp/


$ wget https://releases.hashicorp.com/terraform/0.13.3/terraform_0.13.3_linux_amd64.zip

Unzip the Package

To unzip the downloaded the terraform’s zip file use the following command for that.

$ sudo unzip terraform*

Binary Configuration

Move the extracted files of terraform by following the command.

$ sudo mv terraform /usr/local/bin

Verify the Terraform Version

Use the following command to get installed terraform version.

$ terraform version



Terraform v0.12.29

Install Terrafom using Bash Shell script

#!/bin/bash



cd /tmp/
wget https://releases.hashicorp.com/terraform/0.12.29/terraform_0.12.29_linux_amd64.zip
sudo unzip terraform*
sudo mv terraform /usr/local/bin
terraform version

Get Terraform Help

To get terraform command, Execute the terraform cli like this.

$ terraform

Sample Output :-

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

How to Install Terraform on Ubuntu 16.04/18.04 LTS

Leave a Reply

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

Scroll to top