Installing Terraform


Terraform is a tool for building, changing and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.

Downloading Terraform:

  • Go to the following link and download the latest Terraform of your preferred OS
  • After you download the Terraform .ZIP file, unzip the package. Terraform runs as a single binary file named “terraform”.
  • Now set the terraform binary is available on the PATH. To do this, go to System PropertiesàEnvironmental VariablesàSystem Variablesà
  • Select PATH and click on EDIT. Click NEW and enter the Terraform Path which you have unzipped previously. The path should be similar to the following C:\Users\user_name\folder\Terraform
  • Click OK on all three windows to save it.

Verify the Installation:

  • Open CMD and browse to the Terraform folder
  • Hit “terraform” and as a result, it should display the usage of Terraform which should look the same as below
  • terraform1
  • If this works, you’re terraform is successfully configured, if not check the PATH in environmental Variables.

sample of Building Infrastructure in AWS:

  • Configuration files can be either .tf or .json files. Here I create a .tf file to launch a AWS instance.
  • Create a .tf file and write the code in that file as below
  • terraform2
  • Provide your own access_key, secret_key, preferred region, instance_type, and ami ID
  • Once done save the file (*.tf) and from your CMD, browse to the Terraform folder and give the below command which will displays what changes Terraform will apply as well as the current contents of your configuration “terraform plan”.
  • This should look similar to this
  • terraform3
  • If the plan works good, your configuration is valid.
  • To apply the changes or to create real resources, run “terraform apply” It will take a few minutes since terraform waits for EC2 instances to become available. This will look similar as below
  • terraform4.JPG


Done, you can login into your AWS console and see a new machine (t2.micro) machine has launched

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s