So I’m guessing you’ve heard about Terraform. And maybe you’re now wondering what Terraform is really used for and why it’s so popular?
*What is Terraform used for? The main use of Terraform is for writing infrastructure as code to manage public cloud resources such as AWS, GCP and Azure. Terraform is also commonly used to manage other cloud infrastructure such as Stripe and Auth0. *
Terraform is a powerful tool for writing infrastructure as code, and it has some unique benefits over it’s competition. Let’s look in more detail at some of the main three uses of Terraform.
Terraform is an open-source infrastructure as code tool, mostly used for managing public cloud infrastructure such as AWS, GCP and Azure. Terraform is distributed as a CLI and is used for writing declarative infrastructure as code.
Let’s start our discussion the main three use cases of Terraform with the first and most prominent use case, provisioning public cloud.
One of the main tasks that customers of Terraform us it for is for public cloud provisioning on one of the main cloud providers. Infrastructure as code for these main cloud providers has always been the main focus of Terraform.
Terraform allows use of these public clouds through what’s called a provider. A provider in Terraform can be thought of like a plugin which wraps an existing companies API’s to create declarative Terraform syntax.
The providers which cover the main public clouds are all open source and are closely managed by Hashicorp (the company behind Terraform). As a result, the providers receive frequent updates to match updates from the cloud providers.
This fact that Terraform is used mainly for public cloud is further re-inforced jut by looking at Terraform’s providers registry page where all of the cloud providers are on display prominently above the rest.
The second main use for Terraform is performing multi-cloud deployments.
One of the main appeals of Terraform is how it works across all the cloud providers at the same time, unlike many of Terraform’s direct competitors like CloudFormation, which work primarily with a single cloud provider only.
Being able to deploy resources into multiple cloud providers is useful because software engineers can then use the same syntax and toolchain, without needing to familiarise themselves with multiple tools and technologies.
But there are also strategic advantages to multi-cloud. Multi-cloud support allows companies to leverage unique services that may only be available in one cloud provider, it helps reduce risks of having all cloud assets dependent on a single company, and also can help in the negotiation of contracts.
The final important use of Terraform is its use with custom providers.
As we mentioned before, a provider is a way in Terraform to wrap an existing API and convert it to the Terraform declarative syntax.
The process of creating providers is not just for open source use cases, though. Providers can also be written for internal company use cases where a company wants to convert existing tools or API’s into Terraform.
Any API which supports CRUD (create, read, update, delete) actions can be wrapped in Terraform style declarative code, which gives Terraform lots of flexibility to support many different infrastructure setups.
And that concludes our look at the main uses of Terraform. Terraform is a very powerful for writing infrastructure as code, and as you can see has many perks in it’s features such a multi-cloud deployment and custom providers. Hopefully that helped clear things up for you about what Terraform is and how it’s used.
For more on Terraform and infrastructure as code, I recommend taking a look at: Infrastructure As Code: An Ultimate Guide
If you’re interested in Cloud I write a monthly newsletter for Cloud Software Engineers. I spend the month digging around the internet for the best cloud engineering content and provide a monthly summary. I read every article I share, and I focus on fundamentals as much as possible.