← Back to Blog RSS

What Is Terraform IaC? A Practical Guide

Terraform Infrastructure State Management

Terraform became the default answer to IaC by giving teams one declarative way to manage cloud infrastructure across providers. Now, however, the file-based state model that made early Terraform workflows simple becomes the thing mature teams eventually have to work around.

TL;DR
$ cat terraform-iac.tldr
• With Terraform, you define infrastructure as code in HCL, previewing changes with terraform plan, and provisioning infrastructure with terraform apply instead of relying on manual processes or console clicks.
• Teams adopt Terraform because it gives them a consistent workflow across AWS, Azure, Google Cloud infrastructure, Kubernetes, and thousands of other provider integrations.
• Terraform still leads the IaC market, but once teams scale, state locking and fragmented visibility across multiple state files become real operational limits.

Terraform IaC explained: Core concepts, benefits, and alternatives

IaC, or infrastructure as code, is the standard mechanism modern teams use to manage infrastructure. In fact, Firefly's 2025 State of IaC report says 89% of respondents have adopted IaC.

Manually managing compute instances, load balancers, DNS entries, and foundational resources through an AWS console or a terminal window full of one-off commands does not survive contact with multiple environments, version control systems, and production environments. It's no surprise, then, that Firefly's 2025 report predicts Terraform will likely remain the number one IaC solution, especially among enterprises, even as competition gets stronger.

This article investigates how Terraform actually works, why it became so widely adopted, and where its limits start to show once infrastructure provisioning moves from a solo workflow to something platform teams need to run every day under pressure.

What is IaC?

Infrastructure as code is the practice of defining and managing infrastructure through code files rather than through manual UI clicks or ad hoc CLI commands. IaC enables teams to manage infrastructure with configuration files in a way that is safe, consistent, and repeatable, while making those resource configurations easy to version, reuse, and share.

That sounds simple, but the practical benefit is huge.

When infrastructure code lives in version control, teams can review infrastructure changes the same way they review application code, reproduce the same cloud resources across dev, staging, and production, reduce configuration drift, and avoid the error-prone habit of relying on memory or tribal knowledge.

IaC also makes immutable infrastructure and reliable deployments more realistic, given that the source of truth is declarative configuration files rather than a sequence of manual processes. Terraform is the tool that made the IaC model accessible to a very large part of the industry.

What is Terraform IaC?

Terraform IaC is Terraform used as an infrastructure-as-code tool to define, provision, and manage infrastructure through declarative configuration files.

HashiCorp uses Terraform to describe the desired state of infrastructure in code, then Terraform works out the infrastructure changes needed to reach that state. Terraform, which was written almost entirely in Go, is primarily an infrastructure-as-code tool for building, changing, and versioning infrastructure.

Terraform uses its own configuration language, based on HashiCorp Configuration Language, or HCL. This language is what configuration files use to tell Terraform what plugins to install, what infrastructure to create, and what data to fetch.

As a language, HCL is both human and machine-friendly, a combination that is a big reason Terraform became such a durable code tool for infrastructure management. It's readable enough for reviews, structured enough for automation, and opinionated enough to keep infrastructure configuration from collapsing into hand-rolled scripting.

Terraform is also provider-agnostic. Terraform can manage infrastructure on multiple cloud platforms, and the Terraform Registry currently lists more than 6,000 providers, meaning one toolset can manage AWS, Azure, Google Cloud infrastructure, Kubernetes, SaaS APIs, on-premises infrastructure, and more.

How Terraform IaC works

The Terraform workflow is intentionally simple.

After installing Terraform and running terraform init to initialize the working directory and install the required provider plugins, you

  1. Write configuration files that define resources
  2. Run terraform plan to generate an execution plan
  3. Run terraform apply to execute the proposed operations.

The command terraform init initializes a working directory, terraform plan is the command that previews the changes Terraform intends to make, and terraform apply is the command that executes those operations.

Terraform is also idempotent in the practical sense most teams care about. If the real infrastructure already matches the desired state in your Terraform configuration, terraform plan reports that no actions need to be taken. In other words, rerunning the same configuration should not trigger unnecessary redeploys, which is exactly what you want from infrastructure as code IaC in production environments.

The core concepts of Terraform as an IaC tool

If you want to understand Terraform as an IaC tool rather than just memorize a few terraform cli commands, three building blocks matter more than anything else:

  1. Terraform configuration defines intent
  2. Providers connect that intent to a cloud provider or service API
  3. State records how that intent maps to real infrastructure

Together, they form the core concepts behind most Terraform workflows, whether you are provisioning a single Kubernetes cluster or coordinating large distributed systems across multiple cloud providers.

Configuration files and HCL

Terraform configuration lives in configuration files, usually .tf files, written in Terraform language, which is based on HCL. Their purpose is to define resources, inputs, outputs, and resource configurations in a high-level configuration language that describes what infrastructure should exist, not every step needed to create it. That declarative model reduces cognitive overhead because engineers focus on desired state instead of writing procedural infrastructure code for every cloud service provider API call.

Readability is not cosmetic in infrastructure, which makes HCL a powerful language. As a result, Terraform configuration is easier to review, audit, and collaborate on than a pile of shell scripts. Whether a team is defining compute instances, load balancers, DNS entries, or a shared networking layer for multiple environments, readable configuration files make version control and peer review much less painful.

Providers

Providers are the bridge between Terraform and the APIs of the systems it manages. Every Terraform resource type is implemented by a provider, and the Terraform Registry is the main directory of publicly available providers for most major infrastructure platforms. Essentially, Terraform providers are the provider plugins that let one workflow manage AWS networking, Azure storage, Google Cloud infrastructure, Kubernetes objects, SaaS platforms, and more.

This provider model is a huge part of why Terraform spread so far.

It lets teams keep one consistent workflow even when their cloud infrastructure spans multiple cloud providers, on-premises infrastructure, and third-party services. The size of the registry matters here, too. The public registry currently lists more than 6,000 providers, which turns Terraform from a single-product utility into a general infrastructure provisioning layer. That broad ecosystem is powerful, but it only works because Terraform keeps track of what already exists, and that brings us to state management.

State management

Terraform maintains a state file that maps your configuration to real-world resources. Terraform state is the information used to map resources to configuration, keep track of metadata, and improve performance. Terraform compares your configuration with the state file and existing infrastructure to create plans and make changes. Without state, Terraform would have no reliable way to know what already exists, what needs to change, or what can be destroyed safely.

Local state is fine for one person experimenting in a working directory, but it fails quickly in team settings.

Teams often move to remote backends for shared workflows, as backends control where state is stored and can provide locking. That solves the immediate coordination problem, but it also introduces the state file as a shared dependency.

That trade-off is easy to ignore early on, and impossible to ignore later, which is exactly why the benefits of Terraform are best understood alongside the operational shape they create.

The benefits of using Terraform for IaC

The practical appeal of Terraform IAC is that it standardizes infrastructure management across cloud platforms in a way that is easier to review, reproduce, and scale than manually managing resources in consoles.

Terraform also offers multi-cloud support, human-readable configuration, state-based tracking, and version control collaboration.

These advantages enable teams to define resources once, reuse Terraform modules across multiple environments, and deploy infrastructure with a more consistent workflow.

Terraform also lowers the coordination cost of cloud infrastructure. A declarative model means engineers describe the desired state and allow Terraform to calculate the correct order for resource changes, instead of manually sequencing dependencies between compute, networking, storage, and supporting services.

Add the provider ecosystem and large community, and Terraform becomes a tool that fits existing workflows instead of forcing a team to build a custom platform from scratch. Those strengths explain why Terraform still leads. Now, let's see how Terraform differs from the other IaC tools teams usually consider.

Terraform IaC vs. the alternatives

Terraform is not the only serious IaC option.

Pulumi, AWS CloudFormation, Ansible, and OpenTofu all solve adjacent problems, but they do it from different assumptions about language, scope, and workflow.

The simplest way to think about alternatives to IaC with Terraform is that Terraform optimizes for a shared declarative abstraction across providers, while most competitors optimize for either a narrower ecosystem or a different authoring model.

Here's a table with each tool's key differentiator

Tool Key differentiation point
Terraform Declarative HCL, a broad multi-cloud provider ecosystem, and a mature default choice for shared infrastructure workflows
Pulumi Uses general-purpose programming languages like TypeScript, Python, Go, C#, and Java instead of HCL
AWS CloudFormation AWS-native IaC service focused on modeling and provisioning AWS resources as stacks
Ansible Best known for configuration management, software deployment, and orchestration rather than Terraform-style resource provisioning
OpenTofu Open-source fork of Terraform that aims to stay compatible with most Terraform configurations

Pulumi lets teams write IaC in real programming languages and deploy to any cloud, which can be attractive when infrastructure needs to live closer to application code.

CloudFormation, by contrast, is tightly AWS-native. It helps users model related AWS and third-party resources and provision them as a stack, which makes it a strong fit for AWS-only shops and a weaker fit for multi-cloud support.

Ansible is a broader automation technology that can provision, configure, and orchestrate systems, with a focus on configuration management and software deployment, which is why it's often paired with provisioning tools rather than treated as a direct replacement.

OpenTofu is often singled out as the closest comparable tool to Terraform because it's a Terraform fork created after HashiCorp's license change. Most Terraform code will work without modification on OpenTofu, making it the closest alternative for teams that want Terraform's model without Terraform's licensing path.

So, why does Terraform remain the default in so many environments? It's not perfect at everything, but it's good at enough things, across enough cloud resources, that many teams standardize on it first. The catch is that standardization at a smaller scale and standardization at a team scale are not the same thing.

Where Terraform IaC starts to show its limits

Terraform's biggest operational pain point at scale is state contention. Terraform locks state for operations that could write it, which protects correctness, but the effect in shared environments is serialization around a state file.

This means that a single apply can block unrelated work because the lock sits at the state level rather than the resource level, which turns safety into a queue once enough people and pipelines share the same backend.

The second pain point is visibility.

File-based state works well enough when you need to know whether one stack changed. It works badly when you need to know what resources exist across many states, what depends on what, or what the blast radius of a change might be across environments.

The alternative is a structured, SQL-queryable state with cross-environment visibility, which is a useful way to frame the limit in Terraform's default model. Once infrastructure is fragmented across many state files, the state file stops being just a source of truth and starts becoming a source of operational fragmentation.

Stategraph is the practical alternative when a team wants to keep Terraform but stop treating the state file as a bottleneck.

Instead of asking engineers to switch IaC tools, rewrite Terraform configuration, or abandon existing workflows, Stategraph replaces the backend layer underneath Terraform and changes the part that breaks first at scale. The result is that teams keep using the Terraform CLI, providers, modules, and declarative configuration files they already know, while gaining parallel execution, resource-level locking instead of one global lock, and SQL-queryable state that makes it much easier to understand what infrastructure exists across environments and how changes relate to one another.

Traditional Backend

terraform apply 00:00
[VPC ] waiting
[Subnets ] waiting
[Security ] waiting
[RDS ] waiting
[ALB ] waiting
[ASG ] waiting
[Route53 ] waiting
[CloudFront ] waiting

Stategraph

stategraph apply 00:00
[VPC ] waiting
[Subnets ] waiting
[Security ] waiting
[RDS ] waiting
[ALB ] waiting
[ASG ] waiting
[Route53 ] waiting
[CloudFront ] waiting

Conclusion

Terraform IaC remains the most widely adopted infrastructure-as-code solution for good reasons. It gives teams a declarative model, a massive provider ecosystem, and a workflow built around readable Terraform configuration, terraform plan, and terraform apply. Those strengths are not disappearing, and the broader market still treats Terraform as the leading IaC option even as competitors keep gaining ground.

But the operational reality changes as teams grow. The file-based state model that feels straightforward at the start becomes a genuine constraint when concurrent applies, state file contention, and fragmented visibility start shaping delivery speed more than the Terraform code itself

If you want to keep your existing Terraform configuration but remove those backend constraints, Stategraph is a backend replacement that adds resource-level locking and concurrent execution, and makes infrastructure state queryable through PostgreSQL-backed structured data.

Terraform IaC FAQs

What are the main alternatives to Terraform IaC?

The most common alternatives are Pulumi, AWS CloudFormation, Ansible, and OpenTofu. The right choice depends on whether you want multi-cloud HCL, real programming languages, deep AWS alignment, configuration management, or a Terraform-compatible open-source fork.

How does Terraform IaC differ from other IaC tools?

Terraform differs mainly in its combination of declarative HCL, broad provider ecosystem, and multi-cloud scope. Pulumi prefers general-purpose programming languages, CloudFormation is AWS-native, Ansible centers more on configuration management and orchestration, and OpenTofu follows the Terraform model closely as a compatible fork.

Is Terraform IaC suitable for multi-cloud environments?

Yes. Terraform is able to manage infrastructure on multiple cloud platforms, and the provider registry is large enough to cover major public clouds, Kubernetes, and many third-party services from the same workflow.

What language does Terraform IaC use?

Terraform uses Terraform language, which is based on HashiCorp Configuration Language, or HCL. HCL is designed to be human and machine-friendly, which is part of why Terraform configuration stays readable even as infrastructure grows.

What is a Terraform state file and why does it matter?

A Terraform state file stores the mapping between your configuration and the real infrastructure Terraform manages. Terraform uses that state to understand what already exists, what changed, and what actions are needed to make infrastructure match the desired state defined in code.

Try Stategraph free

If your Terraform state has reached the point where routine operations carry a real time cost, the subgraph approach is worth seeing in practice. Stategraph is self-hosted, works with your existing Terraform configuration, and does not require changes to your provider setup.

Get started with the docs or follow along as we build.