Impressive things about Terraform

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.

I am impressed with the way that Terraform allows us to specify a setup of servers and load balancers and firewalls and whitelists and set it up, and use it for development, and then the day we decide to go public, we only have to run one command to re-create everything in production. That is a high level of automation.

Good people have insisted that this is only possible while using Docker containers, but I don’t see that at all. That might be a standard way to go, but its not the only way to go.

To all the people who are asking “What about service discovery?” I hope you call understand that there are many ways to achieve service discovery?

If your question is “What about when I want to run 100 instances of the same image on one server, and the instance is programmed to use port 8000? They will get a port conflict.”

You might want to read up on service discovery, because a fairly common pattern is to spin 100 instances of an app and have the app randomly pick a port in some range (say between 40000 and 41000) and then push the port number in something like Ect or Consul or ZooKeeper, and then something like Nginx can proxy those ports to port 80. You can either do things the cheap and simple way (proxy every port between 40000 and 41000 regardless of whether there is a service there) or do things the correct way and have an app which reads the ports out of Etc or Consul or ZooKeeper and updates the Ngixin config.

There are more sophisticated ways of doing this, but my point is that it is very easy to do.

Regardless of whether you use Docker, I think Terraform is impressive.

From the Terraform docs:

Tools like CloudFormation, Heat, etc. allow the details of an infrastructure to be codified into a configuration file. The configuration files allow the infrastructure to be elastically created, modified and destroyed. Terraform is inspired by the problems they solve.

Terraform similarly uses configuration files to detail the infrastructure setup, but it goes further by being both cloud-agnostic and enabling multiple providers and services to be combined and composed. For example, Terraform can be used to orchestrate an AWS and OpenStack cluster simultaneously, while enabling 3rd-party providers like Cloudflare and DNSimple to be integrated to provide CDN and DNS services. This enables Terraform to represent and manage the entire infrastructure with its supporting services, instead of only the subset that exists within a single provider. It provides a single unified syntax, instead of requiring operators to use independent and non-interoperable tools for each platform and service.

Post external references

  1. 1
    https://www.terraform.io/intro/vs/cloudformation.html
Source