Quick Answer
Choose AWS CDK when AWS is your platform boundary and you want tested constructs backed by CloudFormation's lifecycle management. Choose Terraform when your infrastructure must span multiple providers and your team is ready to operate state as critical production data. CDKTF, which bridged the two by generating Terraform from CDK code, was deprecated and archived by HashiCorp on December 10, 2025, so it is no longer a viable third option for new projects.
Introduction
AWS CDK vs Terraform is no longer a debate about syntax preference. It is a decision about deployment boundaries, state ownership, and whether your platform is fundamentally AWS-centric. CDKTF once let teams retain Terraform's engine while writing familiar languages, but its shutdown means that abstraction now carries an operational ownership cost. The wrong choice tends to surface during a production incident, when a small infrastructure change requires understanding several layers of generated output.
Key Takeaways
AWS CDK synthesizes to CloudFormation, so state and lifecycle are AWS-managed.
Terraform requires teams to own and secure their own state as a critical artifact.
CDKTF users should migrate deliberately rather than treating generated configuration as a permanent interface.

AWS CDK vs Terraform after CDKTF
The central difference is control plane ownership. AWS CDK synthesizes infrastructure definitions into AWS CloudFormation templates, while Terraform calculates and applies changes through its own provider ecosystem and state model. Both are Infrastructure as Code approaches, but they hand lifecycle responsibility to different systems.
What CDKTF's deprecation actually changes
CDKTF was a bridge, not a neutral convergence of two equivalent systems: developers wrote TypeScript, Python, Java, C#, or Go, then generated Terraform configuration for Terraform to execute. HashiCorp deprecated and archived the project on GitHub on December 10, 2025, and its guidance now recommends standard Terraform and HCL for teams that are not using AWS CDK in the migration guidance for CDKTF.[1]
Existing stacks: Preserve deployed resource addresses before refactoring configuration.
New code: Avoid starting unsupported CDKTF dependencies.
Terraform path: Move generated definitions into maintainable HCL modules.
CDK path: Rebuild AWS-specific stacks as native constructs.
Fork option: Evaluate community ownership as an explicit operational dependency.
Do not mistake a fork for a migration plan
CDK Terrain continues the code-generated approach and supports both Terraform and OpenTofu, with TypeScript, Python, Java, C#, and Go listed among its supported languages. Its documentation describes a community fork that is a community-maintained fork compatible with Terraform and OpenTofu plus Terraform or OpenTofu on the PATH, so adopting it is a conscious choice to own a community project's release and compatibility trajectory, not a drop-in return to vendor-backed CDKTF.[2]

State, deployment, and testing trade-offs
Tool choice becomes real when teams reconcile drift, promote environments, and diagnose failed deployments. Terraform's state is a first-class operational artifact, whereas CDK delegates resource tracking and lifecycle orchestration to CloudFormation. That difference should drive the architecture decision more than the appeal of HCL or a general-purpose language.
Compare the execution models before choosing
This table isolates the differences that affect incident response and team workflow. It does not treat the tools as interchangeable, because generated templates and Terraform state produce different debugging paths.
Dimension | AWS CDK | Terraform | CDKTF after deprecation |
|---|---|---|---|
Deployment engine | CloudFormation | Terraform providers | Terraform-generated configuration |
Primary language | Supported programming languages | HCL | Programming languages plus generated Terraform |
State ownership | CloudFormation stack lifecycle | Terraform state is required | Terraform state plus synthesis layer |
Cloud scope | AWS resources | Provider ecosystem | Terraform or OpenTofu execution |
Testing surface | Constructs and synthesized templates | Modules, plans, and provider behavior | Application code and generated output |
Terraform must store state for managed infrastructure and configuration, and its own documentation warns against putting state in version control or storage without locking and secure access controls. A disciplined Terraform state management practice therefore includes controlled backend access, reviewable plans, and a recovery process for failed or interrupted applies. Use terraform output -json when automation needs root-module output values from the latest state snapshot rather than parsing or modifying the state format directly, which can change across Terraform versions. A Terraform workflow guide also covers state management and declarative configuration workflows.[3]
Testing should target the contract you deploy
Testing AWS CDK applications works best when unit tests assert synthesized resources, permissions, and configuration boundaries rather than only checking that a construct function returned successfully. Construct library development should expose stable inputs and outputs, letting product teams compose approved patterns without copying IAM policies, network defaults, or logging settings into every repository.
Terraform testing should similarly verify module inputs, expected plans, and provider interactions, but teams must not build automation that edits the state format directly because it can change across Terraform versions. This is an architecture trade-off that teams should make explicit: convenience at authoring time can create an opaque failure boundary later. For a broader framework, review these architecture trade-offs.
How to choose and migrate without creating a new platform problem
Do not begin with a rewrite. Start by mapping the deployed resources, their logical addresses, their state backend or CloudFormation stacks, and the release pipeline that changes them. A migration is successful only when ownership and rollback are clearer after the move than they were before it.
Use AWS CDK when AWS is the product boundary
AWS CDK is the stronger default when your product is built entirely on AWS, because it lets teams unify application and infrastructure development in one language while CloudFormation handles the underlying lifecycle and rollback behavior.
Scaling AWS CDK stacks requires boundaries that mirror product ownership rather than a single platform stack that every team edits. Use environment-specific configuration outside construct logic, keep cross-stack references intentional, and treat the bootstrap process as environment setup because AWS describes it as a one-time operation per environment, not a step for every deployment.
Use Terraform when provider portability is a real requirement
Terraform is the stronger default when infrastructure spans multiple cloud providers or on-premises systems, because its provider ecosystem and declarative state model were built for that breadth from the start, at the cost of requiring the team to operate that state as critical production data.
For teams not using AWS CDK, CDKTF recommends migrating to standard Terraform and HCL for long-term support and ecosystem alignment. Before its deprecation, CDKTF supported TypeScript, Python, Java, C#, and Go, giving teams access to the Terraform ecosystem without requiring HCL. This is a technology stack decision, not a syntax cleanup, and technology stack decisions should account for on-call ownership, hiring, review habits, and the number of control planes engineers must debug.

Conclusion
CDKTF's deprecation ends the idea that a hybrid layer is the default safe compromise. Choose AWS CDK when AWS is the platform boundary and your team can benefit from tested constructs, CloudFormation lifecycle management, and application-language abstractions. Choose Terraform when your infrastructure model must span providers and your team is prepared to operate state as critical production data. For AWS-first engineering teams, AWS CDK keeps infrastructure design closer to the product code and deployment system those teams already operate.
Need a sharper framework for platform choices? Use this tech stack evaluation framework for decisions that hold up in production.
Frequently Asked Questions (FAQs)
What is AWS CDK and why use it?
AWS CDK is a framework for defining AWS infrastructure in supported programming languages, and teams use it to package repeatable cloud patterns as constructs that can be tested and reviewed alongside application code.
Why choose CDK over CloudFormation templates?
Choose CDK over CloudFormation templates when reusable abstractions, language tooling, and unit-testable infrastructure code provide more value than authoring raw declarative templates directly.
Is AWS CDK better for senior engineers?
AWS CDK is not inherently better for senior engineers, but it rewards engineers who can design stable abstractions, review synthesized output, and manage the lifecycle implications of AWS resources.
How to unit test AWS CDK constructs?
Unit test AWS CDK constructs by synthesizing a stack and asserting its resource properties, IAM permissions, dependencies, and configuration values rather than only testing helper functions.
Is CDK worth the learning curve?
CDK is worth the learning curve when AWS is central to the product and reusable constructs reduce duplicated infrastructure decisions across services, repositories, and environments.
How to manage multi-environment deployments in CDK?
Manage multi-environment deployments in CDK by separating environment configuration from construct logic, deploying through controlled pipelines, and treating bootstrap resources as one-time setup per environment.
Is AWS CDK production ready for large scale systems?
AWS CDK is production ready for large-scale systems when teams establish stack boundaries, test synthesized templates, control deployment permissions, and maintain clear ownership for cross-stack dependencies.
Sources
- GitHub - hashicorp/terraform-cdk: Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform — GitHub ↩
- CDK Terrain - Open-Source CDK for Terraform & OpenTofu — CDK Terrain ↩
- Terraform workflow guide — blog.ahmadwkhan.com ↩


