
Terraform is a cloud-agnostic Infrastructure as Code (IaC) tool that lets teams define, provision, and manage infrastructure using declarative code instead of manual setup. In this blog, you’ll learn what Terraform is, how it works, and when to use it. You’ll also explore its key components, use cases, and how it compares to other tools plus why OpenTofu has emerged as its open-source successor.
Terraform is one of the most popular tools in the modern DevOps toolkit. If you've ever wondered how large teams automate infrastructure provisioning or how you can deploy cloud environments using just code, you're in the right place.
This guide will walk through what Terraform is, how it works, when to use it, how it compares to other tools, and why OpenTofu is emerging as its open-source successor.
Terraform is an Infrastructure as Code (IaC) tool created by HashiCorp that allows you to define, provision, and manage your infrastructure using a declarative configuration language called HCL (HashiCorp Configuration Language).
With Terraform, you describe what your infrastructure should look like in .tf files, and Terraform figures out how to create and maintain that state for you whether it's on AWS, Azure, Google Cloud, on-premises, or across multiple providers.
Terraform is used to:
Before Terraform, provisioning infrastructure involved manual clicks in cloud dashboards or hand-crafted shell scripts. IaC shifts this paradigm by enabling you to define infrastructure in code.
Terraform consists of two major components:
| Component | Description |
|---|---|
| Providers | Plugins to interface with cloud APIs (e.g., AWS, Azure, Kubernetes) |
| Resources | The infrastructure components you manage (e.g., VM, S3 bucket) |
| Modules | Reusable, composable collections of Terraform configs |
| Variables | Inputs for dynamic configuration and environment flexibility |
| State File | Records the actual infrastructure and metadata terraform.tfstate |
| Workspaces | Used to manage multiple environments (dev, prod, etc.) with shared code |
| Data Sources | Fetch info about existing resources outside Terraform control |
Use Terraform to create temporary dev/test environments that mirror production, saving time and reducing manual setup errors.
With one Terraform configuration, deploy infrastructure across AWS, GCP, and Azure avoiding vendor lock-in.
Manage dependencies between backend databases, application servers, and frontend load balancers all in a single Terraform plan.
Use Terraform to provision Kubernetes clusters and other platforms like Consul or Datadog through available providers.
| Tool | Use Case | Limitations |
|---|---|---|
| CloudFormation | AWS-specific IaC | Locked to AWS |
| ARM Templates | Azure-specific | Verbose syntax |
| Chef / Puppet | Configuration management post-provisioning | Not ideal for provisioning |
| Kubernetes | Container orchestration | Needs infra underneath |
| Custom scripts | Quick & dirty | Hard to maintain at scale |
| Harness IaCM | Enterprise-grade IaC management | Newer ecosystem |
Terraform stands out for being:
Terraform launched in 2014 as an open-source project under MPL 2.0. In 2023, HashiCorp changed Terraform’s license to BSL 1.1, restricting certain commercial use.
In response, OpenTofu was born as a community-driven fork of Terraform under the Linux Foundation, maintaining MPL licensing.
Summary: Why Use Terraform?
Terraform simplifies infrastructure management by turning manual tasks into declarative code. It works across cloud providers, promotes best practices in automation, and scales with your infrastructure needs.
Whether you're launching a side project or managing enterprise-scale cloud deployments, Terraform and increasingly, OpenTofu offer the flexibility, visibility, and power you need.
If you're looking to scale Infrastructure as Code across teams with governance and control, request a demo to see it in action.