DevOps and CI/CD Comparison

Terraform vs AWS CloudFormation

Independent comparison for enterprise buyers. Updated May 2026.

Quick verdict: Choose Terraform for multi-cloud or hybrid estates, broader provider coverage, and a portable IaC skill set that transfers across employers. Choose AWS CloudFormation for AWS-only organisations that prefer a fully managed service with no third-party tooling, native integration with AWS Service Catalog, and no separate state file to maintain. The key differentiator is scope: Terraform manages anything with an API, while CloudFormation manages AWS and select third-party resources through registered extensions.

CriteriaTerraformAWS CloudFormation
Editorial score4.5 / 5.04.0 / 5.0
DeploymentCLI plus HCP Terraform or EnterpriseAWS managed service, no infrastructure to operate
Pricing ModelOpen core under BSL, paid HCP and Enterprise tiersFree service, charges for underlying AWS resources
Target BuyerMulti-cloud and hybrid platform teamsAWS-only organisations, regulated AWS-first estates
Cloud AvailabilityMulti-cloud and SaaS, 4,000+ providersAWS only, third-party via registered extensions
Update CadenceMonthly minor releases, weekly provider updatesContinuous AWS service coverage, lag for new launches
CustomisationHCL, modules, dynamic blocks, for_eachYAML or JSON templates, nested stacks, CDK abstraction
Key LimitationBSL licence and external state managementAWS lock-in, slower coverage of new services
How we researched this comparison. Assessments here synthesise vendor documentation, independent analyst coverage, and aggregated public review-platform sentiment, applied through our methodology. The Editorial score is TechVendorIndex's own editorial estimate — not a count of reviews we collected. How our scores work →

Feature comparison

Terraform and CloudFormation both declare desired state for cloud infrastructure but differ markedly in scope and architecture. Terraform is a portable CLI tool that talks to provider plugins, each implementing a remote API for a specific platform. The same Terraform binary manages AWS, Azure, GCP, Kubernetes, Cloudflare, Datadog, GitHub, and thousands of additional services through provider plugins. State is maintained in a backend that the operator selects: local disk, S3, Azure Blob, GCS, HCP Terraform, or others.

AWS CloudFormation is an AWS managed service. Templates are submitted to a CloudFormation API endpoint that provisions and tracks resources within an AWS account. There is no separate state file; CloudFormation maintains stack state internally. Templates are written in YAML or JSON, with intrinsic functions for parameter resolution, conditional logic, and resource references. The AWS Cloud Development Kit (CDK) provides language-level abstractions over CloudFormation in TypeScript, Python, Java, .NET, and Go, generating templates at synth time.

For AWS service coverage, CloudFormation typically supports new AWS services within weeks of launch as part of AWS internal release processes; some bleeding-edge features still launch CloudFormation support later than the AWS console or CLI. Terraform's AWS provider tracks AWS service changes through community and HashiCorp engineering; coverage is comprehensive but occasionally lags new launches by days or weeks until provider releases ship.

For multi-account and multi-region deployments, CloudFormation StackSets enables fan-out across many accounts and regions through AWS Organisations. Terraform achieves similar patterns through provider aliasing and modules but requires manual orchestration unless a higher-level platform such as HCP Terraform or Spacelift coordinates runs. Drift detection is supported in both tools: CloudFormation provides drift detection as a managed service, while Terraform detects drift through plan operations against state.

Pricing comparison

CloudFormation itself is free; AWS charges only for the underlying resources provisioned. CloudFormation StackSets, change sets, and drift detection have no licence cost. Operational expense comes from the AWS resources, the engineering team operating templates, and any third-party CI orchestration. Terraform's CLI is free under the Business Source Licence introduced by HashiCorp in August 2023, with HCP Terraform priced at approximately $0.00014 per resource hour and Terraform Enterprise starting at $20,000 annually for small teams. Mid-market HCP Terraform spend typically runs $30,000–$150,000 annually depending on workspace count and resource volume.

Total cost of ownership for AWS-only organisations often favours CloudFormation because there is no IaC platform fee. Multi-cloud organisations typically find Terraform's portability outweighs licence cost: maintaining separate IaC tools per provider creates duplicate skill investment and toolchain overhead. Buyers should weigh the BSL licence position for Terraform against the AWS lock-in cost of CloudFormation; OpenTofu provides an MPL alternative for teams uncomfortable with the BSL. Audit risk and indirect costs concentrate around state file management for Terraform and stack lock-in for CloudFormation.

When to choose Terraform

Choose Terraform for organisations operating across multiple cloud providers, hybrid environments, or SaaS platforms that need to be provisioned alongside cloud resources. It suits platform teams that want a portable skill set, a large hiring pool, and reusable modules from the Terraform Registry. Terraform is also the stronger choice when infrastructure code must manage non-AWS resources such as Cloudflare, Datadog, GitHub, or Snowflake alongside cloud accounts. Teams comfortable operating state backends or using HCP Terraform for managed execution will find Terraform the lower-friction multi-cloud option.

When to choose CloudFormation

Choose AWS CloudFormation for organisations standardised on AWS that prefer a fully managed IaC service with no separate state to maintain, no third-party licence, and native integration with AWS Service Catalog, AWS Config, and AWS Organisations. It suits regulated AWS-first estates where minimising third-party tooling simplifies audit and compliance. CloudFormation is also the natural choice for teams using AWS CDK to write infrastructure in TypeScript or Python while still benefiting from the managed CloudFormation service. StackSets users will find native multi-account deployment simpler than equivalent Terraform patterns.

Alternatives to both

OpenTofu
Linux Foundation MPL fork of Terraform, BSL-free
4.4
Pulumi
IaC in Python, TypeScript, Go, and .NET
4.4
AWS CDK
CloudFormation with programming language abstractions
4.3
Crossplane
Kubernetes-native infrastructure composition
4.2
Full Terraform Review Full CloudFormation Review All DevOps and CI/CD

Frequently Asked Questions

Is Terraform or CloudFormation better for AWS?
CloudFormation has tighter native AWS integration, no licence cost, and no state to manage. Terraform has comparable feature coverage with a portable multi-cloud skill set. AWS-only organisations typically choose CloudFormation; organisations using multiple clouds or SaaS platforms typically choose Terraform.
Can CloudFormation manage non-AWS resources?
Limited support exists through CloudFormation Registry extensions and third-party resource providers. Coverage is narrower than Terraform's 4,000+ provider ecosystem. Teams needing to provision SaaS resources such as Datadog, Cloudflare, or GitHub alongside infrastructure typically prefer Terraform for breadth.
How does migration from CloudFormation to Terraform work?
Tools such as cf2tf and former2 generate Terraform configurations from CloudFormation templates. The generated code typically requires manual cleanup for modules, variables, and provider configuration. Plan 4-16 weeks for migrating a non-trivial AWS estate, including state import and pipeline updates.
Does AWS CDK replace CloudFormation?
No. CDK is an abstraction layer that synthesises CloudFormation templates from TypeScript, Python, Java, .NET, or Go code. CDK still uses CloudFormation as the deployment engine. CDK suits engineering teams who prefer programming languages over YAML or JSON templates.
Which has more drift detection capability?
Both detect drift. CloudFormation provides drift detection as a managed service that compares stack resources against templates. Terraform detects drift through plan operations against state. CloudFormation drift detection is simpler to operate; Terraform drift detection is more flexible across non-AWS resources.
Last updated: May 2026

Get a free, independent vendor shortlist

Tell us what you're evaluating and we'll send a tailored shortlist of vendors that actually fit — no vendor funding, no pay-to-play.

6,000+ vendors · 893 comparisons · 48 country guides · Independent & vendor-neutral

Get a Free Shortlist →