Skip to content

#90DaysOfDevOps - An intro to Terraform - Day 57

An intro to Terraform

"Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently"

The above quote is from HashiCorp, HashiCorp is the company behind Terraform.

"Terraform is an open-source infrastructure as a code software tool that provides a consistent CLI workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files."

HashiCorp has a great resource in HashiCorp Learn which covers all of their products and gives some great walkthrough demos when you are trying to achieve something with Infrastructure as Code.

All cloud providers and on-prem platforms generally give us access to management consoles which enables us to create our resources via a UI, generally, these platforms also provide a CLI or API access to create the same resources but with an API we can provision fast.

Infrastructure as Code allows us to hook into those APIs to deploy our resources in the desired state.

Other tools but not exclusive or exhaustive below. If you have other tools then please share via a PR.

Cloud Specific Cloud Agnostic
AWS CloudFormation Terraform
Azure Resource Manager Pulumi
Google Cloud Deployment Manager

This is another reason why we are using Terraform, we want to be agnostic to the clouds and platforms that we wish to use for our demos but also in general.

Terraform Overview

Terraform is a provisioning-focused tool, Terraform is a CLI that gives the capabilities of being able to provision complex infrastructure environments. With Terraform we can define complex infrastructure requirements that exist locally or remote (cloud) Terraform not only enables us to build things initially but also to maintain and update those resources for their lifetime.

We are going to cover the high level here but for more details and loads of resources, you can head to terraform. io


Terraform allows us to create declarative configuration files that will build our environments. The files are written using the HashiCorp Configuration Language (HCL) which allows for concise descriptions of resources using blocks, arguments, and expressions. We will of course be looking into these in detail in deploying VMs, Containers and within Kubernetes.


The ability to check that the above configuration files are going to deploy what we want to see using specific functions of the terraform cli to be able to test that plan before deploying anything or changing anything. Remember Terraform is a continued tool for your infrastructure if you would like to change aspects of your infrastructure you should do that via terraform so that it is captured all in code.


Once you are happy you can go ahead and apply this configuration to the many providers that are available within Terraform. You can see a large number of providers available here

Another thing to mention is that there are also modules available, and this is similar to container images in that these modules have been created and shared in public so you do not have to create them again and again just reuse the best practice of deploying a specific infrastructure resource the same way everywhere. You can find the modules available here

The Terraform workflow looks like this: (taken from the terraform site)

Terraform vs Vagrant

During this challenge, we have used Vagrant which happens to be another Hashicorp open source tool which concentrates on the development environments.

  • Vagrant is a tool focused on managing development environments

  • Terraform is a tool for building infrastructure.

A great comparison of the two tools can be found here on the official Hashicorp site

Terraform Installation

There is not much to the installation of Terraform.

Terraform is cross-platform and you can see below on my Linux machine we have several options to download and install the CLI

Using arkade to install Terraform, arkade is a handy little tool for getting your required tools, apps and clis onto your system. A simple arkade get terraform will allow for an update of terraform if available or this same command will also install the Terraform CLI

We are going to get into more around HCL and then also start using Terraform to create some infrastructure resources in various platforms.


I have listed a lot of resources down below and I think this topic has been covered so many times out there, If you have additional resources be sure to raise a PR with your resources and I will be happy to review and add them to the list.

See you on Day 58