Open Source Infrastructure as Code Tools Teams Actually Use
Eight open source infrastructure as code tools compared: Terraform, OpenTofu, Pulumi, Ansible, Crossplane, AWS CDK, Terragrunt and Chef, with what each does best.
On this page
Short answer
Open source infrastructure as code tools let teams define servers, networks and databases in files that can be reviewed, versioned and applied again. Terraform and OpenTofu lead for multi-cloud provisioning, Pulumi suits teams that prefer real programming languages, and Ansible fits configuration work. The right pick depends on your cloud mix, team skills and how much state you are willing to manage.
Which open source infrastructure as code tools are worth comparing?
The tools worth comparing are the ones teams still run in production: they provision real infrastructure, have active maintainers, and fit a clear job — provisioning, configuration or building a platform. The table below gives the shortlist, and the sections after it explain each tool in turn.
| Tool | What it does | Best for | Language |
|---|---|---|---|
| Terraform | Provisions cloud resources from declarative files | Multi-cloud provisioning | HCL |
| OpenTofu | Community fork of Terraform, same workflow | Teams avoiding licence changes | HCL |
| Pulumi | Provisions infrastructure from real code | Developers who prefer code | Python, TypeScript, Go |
| Ansible | Configures servers and runs tasks over SSH | Configuration and setup | YAML |
| Crossplane | Manages cloud resources as Kubernetes objects | Platform teams on Kubernetes | YAML |
| AWS CDK | Defines AWS infrastructure in code | AWS-only teams | TypeScript, Python |
| Terragrunt | Adds structure on top of Terraform | Large Terraform codebases | HCL |
| Chef Infra | Configures systems from recipes | Fleet configuration at scale | Ruby |
Start with one row, not the whole list. Pick the tool that matches the job you have today — provisioning new cloud resources, configuring servers you already run, or building a platform other teams use — and test it on one small environment first.
Terraform and OpenTofu: the declarative provisioning pair
1. Terraform: best for multi-cloud provisioning
Terraform is the most widely used open source provisioning tool, and the default choice when a team runs more than one cloud. You describe the resources you want in HashiCorp Configuration Language, then run a plan to see the changes before you apply them.
The plan step is the reason teams trust it: nothing changes until you have reviewed the diff. Providers exist for the major clouds, and the module registry gives you tested starting points for common setups.
Pros:
- One workflow across AWS, Azure and Google Cloud
- Plan output shows every change before it happens
- Large module registry and provider ecosystem
Cons:
- State files need care and a shared backend
- HashiCorp Configuration Language is another syntax to learn
2. OpenTofu: best for a community-led Terraform fork
OpenTofu is a fork of Terraform created after HashiCorp changed Terraform's licence in 2023. It keeps the same workflow, the same configuration language and compatibility with most existing modules, so teams can move without rewriting code.
The project is run by the Linux Foundation, which is the point for teams that want a licence they can rely on. New features land on a separate roadmap, so check the release notes before assuming a Terraform feature exists here.
Pros:
- Same workflow and language as Terraform
- Open licence under the Linux Foundation
- Existing modules mostly work unchanged
Cons:
- Smaller ecosystem than Terraform
- Newer, so fewer long-running references
Pulumi and Ansible: code-first provisioning and configuration
3. Pulumi: best for teams that prefer real code
Pulumi lets you define infrastructure in Python, TypeScript, Go or C#, instead of a dedicated configuration language. That suits teams that already write software in those languages, because they can reuse loops, functions and tests they already know.
The trade-off is that infrastructure code starts to look like application code, so it needs the same review discipline. Pulumi also keeps state, like Terraform, so plan for a shared backend from the start.
Pros:
- Real programming languages, not a new syntax
- Good for logic-heavy infrastructure
- Works across the major clouds
Cons:
- State management is still your job
- Smaller module ecosystem than Terraform
4. Ansible: best for configuring servers you already run
Ansible is a configuration tool, not a provisioning tool: it connects over SSH and brings a server to the state you describe, installing packages, writing files and starting services. It is agentless, so there is nothing to install on the machines it manages.
Ansible works best after the infrastructure exists. Teams often pair it with Terraform: one tool creates the servers, the other configures them. Used alone for provisioning, it becomes awkward, because it was not built to track cloud resources.
Pros:
- Agentless and easy to start
- Readable YAML playbooks
- Strong for configuration and patching
Cons:
- Not built to provision cloud resources
- Large fleets need care to stay fast
Crossplane and AWS CDK: platform and single-cloud options
5. Crossplane: best for platform teams on Kubernetes
Crossplane turns cloud resources into Kubernetes objects, so platform teams can offer developers a self-service API for databases, buckets and queues. Developers request a database with a YAML file, and the platform team controls what that request can create.
This fits teams that already run Kubernetes and want one control plane for applications and infrastructure. It is a poor fit for teams without Kubernetes, because the whole model depends on it.
Pros:
- One API for apps and infrastructure
- Strong guardrails for platform teams
- GitOps-friendly by design
Cons:
- Needs Kubernetes to make sense
- Steeper learning curve than Terraform
6. AWS CDK: best for teams that live on AWS
The AWS Cloud Development Kit lets you define AWS infrastructure in TypeScript, Python or Java, and it generates CloudFormation behind the scenes. Teams that already build on AWS get a familiar language and deep coverage of AWS services.
The catch is the scope: it targets AWS only, so a team that later adds another cloud starts again. It also hides the generated templates, which can make debugging harder when a deployment fails.
Pros:
- Full AWS service coverage
- Real languages with types and tests
- Construct libraries speed up common patterns
Cons:
- AWS only
- Generated templates can be hard to debug
Terragrunt and Chef Infra: structure and fleet configuration
7. Terragrunt: best for large Terraform codebases
Terragrunt is a thin wrapper around Terraform that removes repeated configuration: remote state, provider settings and inputs are defined once and reused across environments. Teams with dozens of Terraform modules use it to keep the code dry.
It adds a layer to learn, and it ties you closer to Terraform's workflow. For a small codebase with one or two environments, the extra layer costs more than it saves.
Pros:
- Removes duplicated Terraform setup
- Keeps state and inputs consistent
- Works with existing modules
Cons:
- Another layer to learn
- Overkill for small codebases
8. Chef Infra: best for fleet configuration at scale
Chef Infra configures servers from recipes written in Ruby, and it has been running large fleets for over a decade. It suits teams that need the same configuration applied to hundreds of machines, with reporting on which nodes drifted.
Chef is configuration, not provisioning: it assumes the machines exist. Newer teams often pick Ansible for the same job, but Chef remains a solid choice where its recipes and reporting are already in place.
Pros:
- Mature fleet configuration
- Good drift reporting
- Large cookbook library
Cons:
- Ruby recipes to learn
- Not a provisioning tool
How to choose the right infrastructure as code tool
Choose by the job, the team and the cloud mix, in that order. The steps below turn that into a short trial you can run in a week.
- Name the job first. Provisioning new cloud resources, configuring existing servers and building a developer platform are three different jobs, and each has a natural tool.
- Match the language to the team. If the team writes Python every day, Pulumi or the AWS CDK fits; if the team is operations-led, Terraform's declarative files are easier to review.
- Check the cloud mix. Multi-cloud points to Terraform or OpenTofu; AWS-only points to the CDK; Kubernetes-first points to Crossplane.
- Plan state storage before the first apply. Pick a shared backend with locking, so two people cannot apply at the same time.
- Trial on one small environment. Build a non-production setup end to end, destroy it, and rebuild it before committing the team.
If the trial goes well, roll the tool out one environment at a time. A partner for DevOps services can help set up the backend, the pipeline and the review process around it.
What are the common mistakes?
Most infrastructure as code failures come from process, not from the tool. The mistakes below show up in almost every team that adopts it.
- Clicking in the console and forgetting the code. Manual changes drift from the code, and the next apply overwrites them.
- Storing state on a laptop. State on one machine cannot be shared, locked or recovered.
- No plan review. Applying without reading the plan is how a small change deletes a database.
- Copying modules without understanding them. A module from the registry still needs review for your network and access rules.
- Treating configuration and provisioning as one job. Picking one tool for both usually means it does one of them badly.
Key takeaways
- Terraform and OpenTofu cover multi-cloud provisioning; Pulumi suits teams that prefer real code.
- Ansible and Chef configure servers; they are not provisioning tools.
- Crossplane fits platform teams on Kubernetes; the AWS CDK fits AWS-only teams.
- State needs a shared backend with locking from day one.
- Trial the tool on one small environment before committing the team.
Frequently asked questions
Is Terraform still open source?
Terraform's licence changed in 2023, and the code is no longer under an open source licence. OpenTofu is the community fork that keeps the open licence and the same workflow. Teams starting now usually compare the two and pick based on licence and ecosystem, not features alone.
What is the difference between Terraform and Ansible?
Terraform provisions infrastructure: it creates servers, networks and databases and tracks them in state. Ansible configures machines that already exist, installing software and applying settings over SSH. Most teams use both, with Terraform creating the servers and Ansible configuring them.
Do I need infrastructure as code for a small project?
A small project still benefits: the setup is written down, repeatable and reviewable, which matters the first time a server needs rebuilding. Start with one environment and one tool, and keep the code small. The cost is low when the codebase is small.
What is OpenTofu?
OpenTofu is a fork of Terraform maintained under the Linux Foundation, created after HashiCorp changed Terraform's licence. It uses the same configuration language and workflow, and most existing Terraform modules work with it unchanged. It is the open-licence path for teams that want Terraform's workflow.
How do I store Terraform state safely?
Use a shared backend with locking, such as an object store with a lock table, so two applies cannot run at once. Keep state out of version control, since it can hold sensitive values. Back it up, and restrict who can read it.
Can one tool cover provisioning and configuration?
Some tools try, but each job has a natural fit, and one tool usually does one of them badly. Terraform plus Ansible is the common pairing: one creates resources, the other configures them. Crossplane covers both only inside Kubernetes.