Terraform vs CloudFormation
IaC.
Terraform strengths
Terraform's strengths are multi-cloud reach and an ecosystem that has compounded for a decade. The same tool across AWS, GCP, Azure, Cloudflare, and dozens of niche providers means one mental model and one set of conventions across the stack.
- Multi-cloud and provider breadth. Same syntax, same plan/apply model across providers; the lingua franca of IaC.
- Mature module ecosystem. Public registry with thousands of community modules; for many infrastructure patterns the module already exists.
- Strong third-party tooling. Terragrunt, Atlantis, terratest, Terraform Cloud, OpenTofu fork; rich operational tooling around the core.
- Policy-as-code support. Sentinel and OPA integration for compliance gates; required at scale, available in standard form.
CloudFormation strengths
CloudFormation's strengths are AWS-native depth. New AWS services typically land in CloudFormation first, drift detection ships with the service, and stack-management primitives are native rather than bolted on.
- Native AWS integration. First-class support for new AWS services, IAM-aware, deeply integrated with the AWS Console.
- Drift detection built-in. CloudFormation tracks resource state and surfaces external modifications without third-party tooling.
- Stack management primitives. Nested stacks, change sets, and StackSets are native concepts; cross-account deployment is supported out of the box.
- StackSets at scale. Cross-account, cross-region deployment via a single stack definition; the standard answer for multi-account AWS orgs.
Trade-offs
The trade-offs are real and stable. Syntax, state management, and lock-in decide the pick more often than feature parity does.
- Syntax verbosity. CloudFormation YAML/JSON is verbose; Terraform HCL is more compact and easier to read at scale.
- State management. Terraform state lives in a backend you operate; CloudFormation state lives in the service. Less to break with CloudFormation, less control with it too.
- Vendor lock-in. CloudFormation only deploys to AWS; multi-cloud orgs end up running it alongside another tool, paying the cost of two.
- Change-preview model. Terraform plan and CloudFormation change sets serve the same purpose with different ergonomics; both are reviewable, the question is which your team prefers.
Decision criteria
The decision is shape-driven. AWS-only versus multi-cloud, greenfield versus existing infrastructure, and team preference each point to different answers.
- AWS-only stack. Either tool works; CloudFormation is slightly faster to support new AWS services, Terraform has better third-party tooling.
- Multi-cloud or future multi-cloud. Terraform or Pulumi; avoid AWS-locked IaC if you might need anything outside AWS.
- Existing infrastructure. Stay with what you have; migration cost rarely pays back unless feature parity has shifted significantly.
- Operating-model preference. Push (run from CI) versus pull (long-running controller); both tools support both, but ergonomics differ.