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.
What is 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.
1. Public Cloud Provisioning
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.
2. For Doing MultiCloud Deployments
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.
3. Bespoke Infrastructure As Code
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.
The Many Uses Of Terraform
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
- Cloud Software Engineering Newsletter #22 (March Recap 2021) - April 7, 2021
- Is An AWS Certification Enough To Get You A Job? (Spoiler Alert: No) - March 30, 2021
- Which AWS Certification Should You Take First? The Definitive Answer. - March 15, 2021