Terraform vs CloudFormation: Multi-Cloud vs AWS-Native IaC
Terraform is multi-cloud IaC with HCL and a huge provider ecosystem; CloudFormation is AWS-native, deeply integrated, and state-managed by AWS.
Terraform provisions infrastructure across many clouds and services using HCL and a vast provider registry, with state you manage. CloudFormation is AWS's native IaC service - templates in YAML/JSON, state and drift handled by AWS, and tight integration with AWS features like change sets and stack policies.
| Terraform | CloudFormation | |
|---|---|---|
| Scope | Multi-cloud + many providers | AWS only |
| Language | HCL | YAML / JSON |
| State | Self-managed backend | Managed by AWS |
| Ecosystem | Huge (registry, modules) | AWS-native, CDK on top |
| Best for | Multi-cloud, broad tooling | All-in AWS shops |
In CI
Terraform is the default when you span clouds or want a rich module ecosystem, but you own the state backend and locking. CloudFormation is compelling for AWS-only shops - no state to manage, native change sets, and the latest AWS features often land there first. Both plan and apply cleanly in CI; mind state locking with Terraform and stack drift with CloudFormation.
Speed it up
Cache provider plugins (Terraform) and run plan/apply in CI with locking. The provider downloads and plan run on CI runners; faster managed runners shorten cold setup.
The verdict
Multi-cloud or want the broad ecosystem and modules: Terraform. All-in on AWS and want managed state with native integration: CloudFormation. Pick by cloud scope and how much state management you want to own.