Overview
Terraform, developed by HashiCorp, is an infrastructure as code (IaC) tool designed for provisioning and managing cloud and on-premises resources. It allows developers and operations teams to define infrastructure in a declarative configuration language known as HashiCorp Configuration Language (HCL) or JSON. This approach enables the consistent deployment and management of computing resources, networks, and services across various platforms.
Terraform's core functionality revolves around providers, which are plugins that allow Terraform to interact with different cloud providers (such as AWS, Azure, Google Cloud Platform) and other services (like Kubernetes, GitHub, or DataDog). Users define their desired infrastructure state in configuration files, and Terraform then creates an execution plan to achieve that state. This plan outlines the actions Terraform will take, such as creating, updating, or deleting resources, before any changes are applied.
The tool is particularly suited for organizations operating in multi-cloud environments, as it offers a unified workflow for managing infrastructure regardless of the underlying provider. It helps maintain environment consistency, reduce manual errors, and accelerate deployment cycles. Terraform also manages a state file, which is a record of the infrastructure Terraform has provisioned. This state file is crucial for Terraform to understand the current actual state of the infrastructure and determine what changes are needed to reach the desired state, as detailed in the Terraform state documentation.
Beyond its command-line interface (CLI), Terraform offers managed services like Terraform Cloud and Terraform Enterprise. Terraform Cloud provides remote state management, team collaboration features, policy enforcement, and a private registry for modules. Terraform Enterprise extends these capabilities for larger organizations, offering self-hosted options, advanced governance, and audit trails. The adoption of IaC tools like Terraform is a key component of modern DevOps practices, enabling automated, repeatable, and version-controlled infrastructure deployments, a concept explored in various industry analyses such as those by Gartner's definition of Infrastructure as Code.
Key features
- Declarative Configuration Language (HCL): Defines infrastructure using a human-readable and machine-friendly language, allowing users to specify the desired end-state rather than a sequence of steps.
- Provider Ecosystem: Supports a vast array of cloud providers (AWS, Azure, GCP, Oracle Cloud), SaaS providers, and on-premises solutions through a rich ecosystem of official and community-maintained Terraform providers.
- Execution Plans: Generates a plan detailing the infrastructure changes before they are applied, enabling review and approval processes to prevent unintended modifications.
- State Management: Maintains a state file to map real-world resources to your configuration, track metadata, and improve performance for large infrastructures. This allows Terraform to understand current infrastructure and plan changes accurately.
- Module Reusability: Enables the creation of reusable, parameterized modules to encapsulate common infrastructure patterns, promoting consistency and reducing boilerplate code.
- Remote Operations: Terraform Cloud and Enterprise offer remote execution, state management, and collaboration features, allowing teams to work together on infrastructure deployments.
- Policy as Code: Integrate with Sentinel (HashiCorp's policy as code framework) to enforce governance policies on infrastructure changes before they are applied.
- Multi-Cloud Support: Provides a consistent workflow for provisioning and managing resources across different cloud environments, reducing vendor lock-in and simplifying hybrid cloud strategies.
Pricing
Terraform offers a tiered pricing model, including a free tier and paid options for advanced features and larger teams.
| Tier | Description | Key Features | Price (as of 2026-05-08) | Details |
|---|---|---|---|---|
| Terraform Cloud Free | For individuals and small teams. | Remote operations, shared state, private registry, up to 5 users. | Free | Terraform Pricing Page |
| Terraform Cloud Standard | For growing teams with more resources. | Includes Free tier features, plus unlimited users, concurrent runs, cost estimation, and audit logs. | Starts at $0.00014 per resource hour | Terraform Pricing Page |
| Terraform Cloud Plus | For organizations requiring advanced governance and security. | Includes Standard tier features, plus Sentinel policy as code, run-time environments, and advanced security. | Contact sales | Terraform Pricing Page |
| Terraform Enterprise | Self-hosted solution for large enterprises with complex needs. | All Cloud Plus features, private networking, air-gapped deployments, and dedicated support. | Contact sales | Terraform Pricing Page |
Common integrations
- AWS: Provision and manage Amazon EC2 instances, S3 buckets, VPCs, RDS databases, and other AWS services using the Terraform AWS provider.
- Azure: Automate the deployment of Azure Virtual Machines, Azure SQL Database, Azure Kubernetes Service (AKS), and other resources with the Terraform AzureRM provider.
- Google Cloud Platform (GCP): Manage Google Compute Engine, Google Kubernetes Engine (GKE), Cloud Storage, and other GCP services via the Terraform Google provider.
- Kubernetes: Deploy and manage Kubernetes resources such as deployments, services, and namespaces using the Terraform Kubernetes provider.
- Docker: Automate the creation and management of Docker containers and images with the Terraform Docker provider.
- GitHub: Manage GitHub repositories, teams, and webhooks as code using the Terraform GitHub provider.
- Datadog: Configure Datadog monitors, dashboards, and other settings through the Terraform Datadog provider for observability as code.
Alternatives
- Pulumi: An IaC tool that allows users to define infrastructure using general-purpose programming languages (e.g., Python, TypeScript, Go).
- AWS CloudFormation: Amazon's native IaC service for provisioning AWS resources, using JSON or YAML templates.
- Ansible: An open-source automation tool for configuration management, application deployment, and orchestration, primarily using YAML playbooks.
- Chef Infra: A configuration management tool that uses Ruby to define infrastructure as code, focusing on server configuration.
- Puppet: Another configuration management tool that uses its own declarative language to manage infrastructure and automate operational tasks.
Getting started
This example demonstrates how to provision an Amazon S3 bucket using Terraform. Ensure you have the Terraform CLI installed and AWS credentials configured.
# 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-platformdex-bucket-2026"
tags = {
Name = "MyPlatformdexBucket"
Environment = "Development"
}
}
# Output the S3 bucket name
output "s3_bucket_name" {
value = aws_s3_bucket.example_bucket.bucket
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 (what Terraform will do). - Run
terraform applyand typeyeswhen prompted to provision the S3 bucket. - After the bucket is created, you can run
terraform destroyto remove the resources.