Skip to main content
Lexicon
Lexicon
Terraform

Terraform

Difficulty: Intermediate
5 min read
Updated 2026-08-19

In plain English

Plain definition

Terraform is a tool that lets you describe the infrastructure you want (servers, networks, databases and other resources) in text files, and then have that description automatically created, changed or removed in the real world. Instead of clicking through consoles or running one-off scripts, you write down the desired end state, and Terraform works out what needs to happen to get there.

How Terraform plans changes

HashiCorp’s open-source Terraform uses a declarative configuration language, HashiCorp Configuration Language (HCL), to define resources and their relationships. Terraform maintains a state file that records the last-known attributes of managed resources, compares that state against the configuration and the real infrastructure, and computes an execution plan describing the additions, changes and deletions required to reconcile the two. Providers, the plugins for platforms such as AWS, Azure, Google Cloud or Kubernetes, translate Terraform’s resource model into calls against each platform’s API.

Why teams use Terraform

Terraform is used to provision and manage infrastructure consistently across environments, reducing configuration drift and manual error. Its plan-before-apply workflow gives whoever runs it a preview of intended changes before they take effect, which supports change review and approval processes. Because configuration is version-controlled text, infrastructure changes can go through the same review, testing and audit practices as application code. That helps most wherever infrastructure changes have to be predictable, reviewable and reversible.

Where Terraform sits in a platform

Terraform sits at the provisioning layer of a platform architecture: it creates and manages the underlying compute, network, storage and identity resources that other tools then configure or deploy onto. It is commonly paired with configuration-management tools (for in-instance configuration) and with CI/CD pipelines (to gate and automate plan/apply cycles). The state file is the dependency that matters most: it must be stored and locked reliably (for example in a remote backend) so that concurrent runs do not corrupt or diverge from the true infrastructure state.

A one-bucket configuration

A minimal Terraform configuration might declare a single cloud storage bucket:

resource "aws_s3_bucket" "example" {
  bucket = "kby-example-bucket"
}

Running terraform plan shows what would be created; running terraform apply creates it and records the result in state.

The configuration is not the whole picture

It is easy to assume that Terraform configuration alone is authoritative. Terraform’s view of the infrastructure depends on its state file matching reality; manual changes made outside Terraform (through a console or another tool) can cause state to diverge from the actual infrastructure, leading to unexpected plans or failed applies. Terraform reconciles configuration against state, not against a live re-scan of every resource by default, so drift correction requires deliberate action such as terraform refresh or terraform plan review.

Terms that come up with Terraform

  • Infrastructure as Code (IaC)
  • HashiCorp Configuration Language (HCL)
  • State file
  • Provider (Terraform)
  • Terraform plan/apply workflow

Further Reading

  • Terraform documentation (HashiCorp): the canonical reference for configuration syntax, providers and workflow commands.

Before you apply to shared infrastructure

Before relying on any Terraform-managed environment, confirm the installed Terraform version and provider versions against the configuration’s required version constraints, and validate configuration syntax and an execution plan in an isolated or non-production workspace before applying to shared infrastructure. If state appears inconsistent with real infrastructure, look for manual changes and reconcile them deliberately instead of applying blind.

About this page

Credited to

Dates

Published

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.