Overview
Terraform is an infrastructure as code (IaC) tool that allows developers to define and provision infrastructure using a declarative configuration language. Instead of manually configuring servers, databases, and networks, users write configuration files that describe the desired state of their infrastructure. Terraform then automates the process of achieving that state, whether it's provisioning new resources, modifying existing ones, or decommissioning old ones.
Terraform's primary strength lies in its ability to manage infrastructure across a wide array of providers, including major cloud platforms like AWS, Azure, and Google Cloud Platform, as well as SaaS providers and on-premises solutions. This multi-cloud capability is crucial for organizations aiming to avoid vendor lock-in or those operating hybrid cloud environments. The tool maintains a state file, typically stored remotely in production environments, which acts as a source of truth for the deployed infrastructure. This state file allows Terraform to understand what resources already exist and how they relate to the desired configuration, preventing unintended changes and enabling collaborative infrastructure management.
The core of Terraform's functionality is its command-line interface (CLI) and its extensive ecosystem of providers. Providers are plugins that allow Terraform to interact with different APIs, translating HCL configurations into API calls specific to each service. This modular approach allows for rapid expansion of supported services without requiring changes to Terraform's core. For instance, the AWS provider documentation details how to manage Amazon Web Services resources, while the Google Cloud provider documentation shows how to manage Google Cloud Platform resources.
Terraform is well-suited for teams that require consistent, repeatable, and version-controlled infrastructure deployments. Its declarative nature simplifies complex infrastructure setups, making it easier to audit changes, roll back to previous states, and onboard new team members. The tool supports team collaboration through Terraform Cloud and Terraform Enterprise, which offer features like remote state management, run histories, policy enforcement, and role-based access control. These features are designed to streamline the IaC workflow for larger organizations and distributed teams.
The HashiCorp Configuration Language (HCL) used by Terraform is designed to be human-readable and expressive, making it relatively accessible for developers and operations teams. Its syntax allows for defining resources, variables, outputs, and modules, enabling the creation of reusable and modular infrastructure components. This promotes best practices in infrastructure management, treating infrastructure definitions like application code.
Key features
- Declarative Configuration Language (HCL): Defines infrastructure using a high-level, human-readable syntax that describes the desired end state, rather than a sequence of operational steps.
- Multi-Cloud and Multi-Provider Support: Manages infrastructure across various cloud platforms (e.g., AWS, Azure, GCP) and on-premises solutions through a system of pluggable providers.
- Infrastructure State Management: Tracks the current state of managed infrastructure in a state file, enabling Terraform to understand existing resources and plan changes effectively.
- Execution Plans: Generates a detailed plan of proposed changes before applying them, allowing users to review potential impacts and ensure correctness.
- Resource Graph: Builds a graph of all resources and their dependencies, enabling parallel provisioning and correct ordering of operations.
- Modules: Supports the creation of reusable, parameterized infrastructure configurations, promoting consistency and reducing duplication.
- Terraform Cloud/Enterprise: Offers remote state storage, team collaboration features, policy enforcement (Sentinel), and cost optimization capabilities for managing Terraform at scale.
- Extensible Provider Ecosystem: A wide range of community and officially maintained providers allows interaction with almost any platform or service that exposes an API.
Pricing
Terraform Cloud offers various tiers, including a free option for individual users and small teams, and paid tiers based on resource consumption. Enterprise pricing is custom and tailored to specific organizational needs.
| Tier | Description | Pricing Model | Details |
|---|---|---|---|
| Free | For individuals and small teams. | Free | Includes remote state, shared module registry, private module registry, and up to 500 managed resources. |
| Standard | For growing teams needing enhanced collaboration and control. | $0.00015 / resource / hour | Includes everything in Free, plus unlimited managed resources, concurrent runs, cost estimation, and basic policy as code. |
| Plus | For organizations requiring advanced governance and security. | $0.0003 / resource / hour | Includes everything in Standard, plus continuous validated deployments, advanced policy as code, audit logs, and service provider integrations. |
| Enterprise | For large organizations with complex needs. | Custom pricing | Includes everything in Plus, plus self-hosted agents, air-gapped deployments, and dedicated support. |
Pricing information is current as of May 2026. For the most up-to-date details, refer to the Terraform Cloud pricing page.
Common integrations
- Amazon Web Services (AWS): Provision and manage EC2 instances, S3 buckets, VPCs, RDS databases, and other AWS resources using the AWS Provider for Terraform.
- Google Cloud Platform (GCP): Deploy and manage Google Compute Engine VMs, Cloud Storage, Google Kubernetes Engine clusters, and more with the Google Provider for Terraform.
- Microsoft Azure: Automate the provisioning of Azure Virtual Machines, Azure SQL Database, Azure Kubernetes Service, and other Azure services via the Azure Provider for Terraform.
- Kubernetes: Manage Kubernetes resources such as Deployments, Services, and Ingress directly using the Kubernetes Provider for Terraform.
- Helm: Deploy Helm charts to Kubernetes clusters using the Helm Provider for Terraform.
- Docker: Automate the creation and management of Docker containers and images with the Docker Provider for Terraform.
- Datadog: Configure Datadog monitors, dashboards, and integrations as code using the Datadog Provider for Terraform.
- Git Version Control Systems: Integrates with Git (e.g., GitHub, GitLab) for versioning of configuration files and CI/CD pipelines. Terraform Cloud supports direct integration with GitHub as a VCS provider.
Alternatives
- Pulumi: An infrastructure as code tool that allows users to define infrastructure using general-purpose programming languages like Python, TypeScript, Go, or C#.
- AWS CloudFormation: Amazon's native IaC service for provisioning and managing AWS resources exclusively, using JSON or YAML templates.
- Ansible: An open-source automation engine that automates software provisioning, configuration management, and application deployment, often used for post-provisioning configuration with YAML playbooks.
- Azure Resource Manager (ARM) Templates: Microsoft Azure's native IaC service for defining and deploying Azure resources using JSON templates.
- Google Cloud Deployment Manager: Google's native IaC service for deploying Google Cloud resources using YAML configuration files or Python templates.
Getting started
To begin using Terraform, you'll need to install the Terraform CLI and create a .tf file to define your infrastructure. The following example demonstrates how to provision a simple AWS S3 bucket. This requires you to have AWS credentials configured in your environment.
# main.tf
# Configure the AWS provider
provider "aws" {
region = "us-east-1"
}
# Create an S3 bucket
resource "aws_s3_bucket" "example_bucket" {
bucket = "my-unique-terraform-example-bucket-20260507"
acl = "private"
tags = {
Name = "My Terraform S3 Bucket"
Environment = "Development"
}
}
# Output the bucket name
output "s3_bucket_name" {
value = aws_s3_bucket.example_bucket.id
description = "The name of the S3 bucket"
}
To apply this configuration:
- Save the code above as
main.tfin an empty directory. - Open your terminal in that directory.
- Run
terraform initto initialize the working directory and download the AWS provider. - Run
terraform planto see the execution plan of what Terraform will do. - Run
terraform applyto execute the plan and create the S3 bucket. Typeyeswhen prompted. - After the bucket is created, run
terraform destroyto remove the resources, again typingyeswhen prompted.
For more detailed instructions and advanced configurations, refer to the official Terraform documentation.