Terraform is the most popular cloud resource provisioning toolset in use today. It is the most important tool to use when deploying immutable infrastructure on the cloud.

Terraform at it's core is a tool to call API's or scripts in a specific order. In a sense, most systems admin tasks and deployment pipelines break down to this. It does this by building a graph of different API calls and then traverses the graph calling each API in order. The order of these API calls is determined by providers of which there are many [official](file:///C:/Users/rob/PycharmProjects/blockchain/icon/insight-icon-docs/docs/infrastructure/terraform-docs/) and [unofficial](file:///C:/Users/rob/PycharmProjects/blockchain/icon/insight-icon-docs/docs/infrastructure/terraform-docs/) providers which provide both API wrappers and interfaces that can be used to determine which API calls need to be called before another.

Writing terraform is in all honesty pretty straightforward with all the examples you see out there. Small projects are very easy to setup and there are a ton of good examples to show you what to do. The hard part is knowing exactly what to do in how you setup your architecture but in many respects it's like playing with legos. You know you need a load balancer for instance, then you look up the load balancer in the docs, see the required interfaces, and then connect the dots. This is pretty straightforward as long as you know what you are trying to do, ie distribute traffic to a series of autoscaling group and have the traffic behave in a certain way.

The hard part about terraform is when your project grows and needs to integrate with a lot of different systems. This means that you might have an application running on a webserver but need to dynamically pull in information about the systems it touches which requires a little strategizing. For instance lets say you are in charge of running a webserver in a large deployment. You are not in charge of the network but your webserver needs to be deployed in 5 different VPCs. You can't hard code those VPCs because you don't want to look them up each time you deploy, thus you need to pull the vpc_id in dynamically. In short, small deployments that you don't plan on changing much are pretty simple because you can put everything in one place. Large deployments on the other hand require a little thought less you want to deal with a jungle of code.

This documentation is not a complete tutorial of how to use Terraform as there are plenty of other guides to walk you through the basics. If you are new to Terraform, check out these tutorials to get more fulsome explanation and then read on to get a more opinionated overview of how to use Terraform.

Terraform Tutorials


Anything that is not covered in these tutorials will be covered in the docs.

What you should know

After going through those tutorials, this is basically what you should know.

Terraform Modularization