Aren’t you tired creating your cloud networks, compute nodes, storage services and all other resources manually?

What do you do if you just need a development or test environment for few hours or even for minutes?

How do you ensure that your production environment is always consistent?

If you are not clearly answer the above questions, this blog post is for you!


Applications are evolving and market expectations are changing. Time is gold, and companies that know the importance of time will win. Today, you don’t have a luxury to wait for 2 weeks to test your application, deploy a network or server. Automated build pipelines help to developers and organizations to speed up the go to market process. However, still there is a bottleneck.

Infrastructures that run the applications are mostly managed by infrastructure teams. They manage servers, networks, storages, middleware components and runtimes. Even your developer team fixes an issue on the application, they will need a test environment. There are few possible ways to run this environment.

First way is a traditional way. You can build a test environment in your on-prem data center and install all required elements, e.g., servers, networks, storage systems. This is a good approach to ensure that you always have a ready to use test environment. However, on the other side, it requires maintenance, a team to manage environment, licensing fees and data center fees, e.g., power, cooling.

Second way is a bit more flexible. You can use a cloud provider to build your test environment and this removes the all upfront costs. You don’t need to think for power, cooling, license fees or maintenance. Even this approach looks better, it still has a drawback. Cloud providers pay as you go plans will be expensive than contract-based plans. You may a sign a contract-based plan but wait a minute? Do you really need to run test environment 24/7?

Third way will be the best option. You can use a cloud provider’s pay as you go plan, however you don’t need to host all test environment components 24/7. You can just deploy the services when they are required, then destroy all components when you finish your task. Probably, you think this will be a time-wasting, but wait a minute. Terraform is here!


Terraform is an open-source software that gives you an opportunity to implement your infrastructure component as code. This concept called as Infrastructure as Code (IaC) and Terraform is a tool that implements IaC functionality.

Terraform is created by HashiCorp and it is an open-source tool. It uses HCL (HashiCorpLanguage) as a primary language. HCL has an easy syntax to learn and this ensures that your learning curve will not be high.

Using Terraform, you just code what you want to build on which service provider. Terraform talks to service provider APIs and handle all Create/Update/Delete operation for you.

For example, if you want to create a Droplet on DigitalOcean, following code will be more than enough to get it.

resource "digitalocean_droplet" "web" {
  image  = "ubuntu-18-04-x64"
  name   = "web-1"
  region = "nyc2"
  size   = "s-1vcpu-1gb"


Terraform configurations are idempotent. It means that, same operation will always give the same results. For example, if you want to create an EC2 machine, in the first run machine will be created. However, following runs will not create the duplicate machines, as because you want only one EC2.

Terraform uses declarative language. Declarative language means that you don’t need to code each step of operation. You can just ask for an S3 Storage, and Terraform will handle all low-layer operations.

Using Terraform, you can save a lot of time while deploying your infrastructure components. Especially for development/testing pipelines. As we discussed above, most of the time you don’t need to run a testing environment 24/7. Integrating Terraform to your CI/CD pipelines will be beneficial to hold your infrastructure cost at minimum. CI/CD pipelines can trigger your Terraform configuration to bring up the test environment and remove all elements after test operation done.


Terraform gives you an easy way to manage your infrastructure elements, managing costs and save a lot of time. HCL language is easy to learn but Terraform itself has a learning curve. Following the best practices are important to ensure that your environment is secure. As because now you are delegating your management tasks to a “Code”, a human error or poorly configured pipeline may disrupt your environment. You just need to aware of possible risks and prepare your environment to reduce any chance of error. Storing your Terraform code on GitHub would be a good decision!

Hope you enjoyed to learn what Terraform is! You can checkout other Terraform posts to learn more about it!

Do you use Terraform? What do you think about it? Let’s share your comments below!


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.