7 Best Infrastructure as Code Tools Compared for 2026
Key takeaways
- Terraform and OpenTofu share the same HCL language and provider model; the main split is licence and governance.
- Pulumi and AWS CDK suit teams that would rather write TypeScript, Python or Go than a configuration language.
- CloudFormation is the native AWS option with no state file to manage, at the cost of being tied to one cloud.
- Crossplane moves provisioning into a Kubernetes control plane, and Ansible remains the pick for configuring servers after they exist.
What infrastructure as code tools are for
An infrastructure as code tool turns a written description of servers, networks, databases and permissions into real cloud resources, and keeps them matching that description over time. Teams use one so every environment is reviewed in a pull request and can be rebuilt from version history. Concepts such as declarative styles and drift are covered in our concepts guide, so this article stays on tool fit. The real differences come down to four things: the language you write in, where state lives, which clouds and services are supported, and who controls the project's future.
Quick comparison
| Tool | Best for | Starting price | Free plan |
|---|---|---|---|
| Terraform | Multi-cloud teams that want the largest provider catalog | Not included | Yes |
| OpenTofu | Teams that want an open source Terraform-compatible tool | Free (open source) | Yes (open source) |
| Pulumi | Developers who prefer general-purpose languages | Free (open source) | Yes (open source) |
| AWS CloudFormation | AWS-only shops that want a native service | Not included | Not included |
| AWS CDK | AWS teams that want code with CloudFormation underneath | Free (open source) | Yes (open source) |
| Crossplane | Platform teams building on Kubernetes | Free (open source) | Yes (open source) |
| Ansible | Configuring servers and running ordered tasks | Free (open source) | Yes (open source) |
The best infrastructure as code tools
1. Terraform
- Official site: https://developer.hashicorp.com/terraform
- Best for: Multi-cloud teams that want the largest provider catalog
- Starting price: Not included
- Free plan: Yes
- Pros: Huge provider and module ecosystem; Plan output shows changes before they apply
- Cons: Source-available licence rather than open source; State file needs careful handling
Terraform from HashiCorp is the tool most infrastructure engineers meet first. Providers cover the major clouds plus hundreds of SaaS products, DNS hosts and monitoring services.
The trade-off is state. Terraform records what it manages in a state file that must be stored remotely, locked during runs and protected, since it can hold sensitive values. Since 2023 Terraform ships under the Business Source License, which matters to teams with strict open source policies.
2. OpenTofu
- Official site: https://opentofu.org/
- Best for: Teams that want an open source Terraform-compatible tool
- Starting price: Free (open source)
- Free plan: Yes (open source)
- Pros: Open source licence under the Linux Foundation; Drop-in for most existing Terraform code
- Cons: Newer features can diverge from Terraform over time; Some commercial tooling targets Terraform first
OpenTofu is the community fork of Terraform created after the licence change, governed under the Linux Foundation and released under the Mozilla Public License 2.0. It reads the same HCL, uses the same provider protocol and works with existing modules, so many teams switch by swapping the binary in their pipeline.
The project has added features of its own, including client-side state encryption, which closes one of the long-standing complaints about plain-text state. The honest limit is divergence: code using a new feature in one may not run in the other. Pick one and pin its version in CI.
3. Pulumi
- Official site: https://www.pulumi.com/
- Best for: Developers who prefer general-purpose languages
- Starting price: Free (open source)
- Free plan: Yes (open source)
- Pros: Write infrastructure in TypeScript, Python, Go, C# or Java; Normal testing and packaging tools apply
- Cons: Code can grow complex without team conventions; Managed backend features sit in the paid cloud service
Pulumi lets you define infrastructure in real programming languages, with loops, functions, classes and the package manager you already use. A program declares resources, and the Pulumi engine works out the diff and applies it, much like a Terraform plan. State can live in Pulumi Cloud or in your own object storage.
It suits developers who want unit tests, type checking and IDE completion. The risk is the flip side of that freedom: a clever abstraction can be harder to review than flat HCL. Shared components and clear conventions help.
4. AWS CloudFormation
- Official site: https://aws.amazon.com/cloudformation/
- Best for: AWS-only shops that want a native service
- Starting price: Not included
- Free plan: Not included
- Pros: No state file to host or lock; Change sets and drift detection built in
- Cons: AWS only; Long YAML or JSON templates are hard to maintain by hand
CloudFormation is the provisioning service built into AWS. You write a template in YAML or JSON, deploy it as a stack, and AWS tracks the resources, rolls back failed updates and shows change sets before you commit. Because AWS keeps the state, there is no backend to secure.
It fits organizations that run entirely on AWS and value a supported, native path. Templates get long fast, and support for brand-new AWS features can arrive after the console and SDKs. Many teams generate it with the CDK instead.
5. AWS CDK
- Official site: https://aws.amazon.com/cdk/
- Best for: AWS teams that want code with CloudFormation underneath
- Starting price: Free (open source)
- Free plan: Yes (open source)
- Pros: High-level constructs cut boilerplate; Deploys through CloudFormation stacks
- Cons: AWS focused; Debugging means reading the generated templates
The AWS Cloud Development Kit is an open source framework for defining AWS infrastructure in TypeScript, JavaScript, Python, Java, C# or Go. Your code builds a tree of constructs, and the CDK synthesizes it into CloudFormation templates that deploy as normal stacks. Higher-level constructs bundle sensible defaults.
The cost is two layers to understand: when a deployment fails, the error often points at the generated template rather than your code. It also stays inside AWS, so mixed-cloud teams usually look at Pulumi or Terraform instead.
6. Crossplane
- Official site: https://www.crossplane.io/
- Best for: Platform teams building on Kubernetes
- Starting price: Free (open source)
- Free plan: Yes (open source)
- Pros: Continuous reconciliation fixes drift automatically; Compositions expose simple self-service APIs
- Cons: Requires running and securing Kubernetes; Steeper learning curve than a CLI tool
Crossplane is a CNCF project that extends Kubernetes so cloud resources become custom resources managed by controllers. Providers talk to AWS, Azure, Google Cloud and other APIs, and compositions let a platform team define its own higher-level types, such as a database that bundles an instance, a subnet group and credentials.
Unlike plan-and-apply tools, Crossplane reconciles constantly, so manual changes get reverted without anyone running a command. For a small team without a cluster, the operational overhead is hard to justify.
7. Ansible
- Official site: https://docs.ansible.com/
- Best for: Configuring servers and running ordered tasks
- Starting price: Free (open source)
- Free plan: Yes (open source)
- Pros: Agentless over SSH; Readable YAML playbooks
- Cons: No state file, so drift and deletions need care; Less suited to large cloud resource graphs
Ansible, backed by Red Hat, runs tasks on machines over SSH or WinRM without installing an agent. Playbooks written in YAML call modules that install packages, write config files, manage services and also create cloud resources. It is the long-standing choice for configuring operating systems and middleware once servers exist.
Ansible works through tasks in order and checks current state for each, but it does not keep a full resource map. Removing a resource from a playbook does not delete it, so teams often pair Terraform or OpenTofu for provisioning with Ansible for configuration.
How they differ
The tools fall into three camps. Terraform and OpenTofu use a purpose-built language, an explicit plan step and a state file you host. Pulumi and AWS CDK let you write code; Pulumi runs its own engine across many clouds, while CDK compiles down to CloudFormation and stays on AWS. CloudFormation and Crossplane keep state on a server side, either the AWS service or the Kubernetes API, and Crossplane goes further by reconciling continuously.
Ansible sits apart because it is task-driven, strong at configuring servers and weaker at tracking large graphs of cloud objects. Licence is the other axis: OpenTofu, Pulumi, CDK, Crossplane and Ansible are open source, while Terraform is source-available.
How to choose
Start from where your infrastructure lives. If it is all AWS and your team writes TypeScript or Python, the CDK is the shortest path. If you span several clouds or many SaaS providers, choose Terraform or OpenTofu; pick OpenTofu if an open source licence is a requirement, and Terraform if you want HashiCorp's managed service. If developers own infrastructure and want tests and types, Pulumi is the better fit. If you already run Kubernetes and want a self-service platform with drift correction, use Crossplane. Keep Ansible for server configuration either way. Most teams end up with one provisioning tool plus Ansible.
How we chose
We reviewed vendor docs, official project pages and public documentation for each tool, focusing on language support, state handling, licence, cloud coverage and maintenance status. We did not run our own trials or measure performance. Check vendor pages for current pricing.
FAQ
Is OpenTofu a drop-in replacement for Terraform?
For most existing code, yes. It reads the same HCL and uses the same providers. Run a plan after switching to confirm no changes, and avoid features unique to one tool if you might move again.
Should I use Pulumi or AWS CDK?
Use the CDK if you are only on AWS and like CloudFormation's managed state and rollback. Use Pulumi if you need several clouds or want to avoid the CloudFormation layer.
Can Ansible replace Terraform?
It can create cloud resources, but it does not track a full resource graph or delete what you remove from code. Most teams use a provisioning tool and Ansible together.
Do I need Kubernetes to use Crossplane?
Yes. Crossplane runs as controllers inside a Kubernetes cluster, so it suits teams that already operate one.
Where should Terraform state be stored?
In a remote backend with locking and encryption, such as object storage with a lock mechanism or a managed service. Never commit state to Git, since it can contain secrets.