Skip to main content
In this lesson we introduce CDKTF (Cloud Development Kit for Terraform) as a practical alternative to authoring infrastructure purely in HCL. CDKTF enables you to define infrastructure using familiar programming languages (TypeScript, Python, Java, C#, Go) while still leveraging Terraform’s provider ecosystem, state model, and CLI workflows. This hybrid approach helps teams build reusable, testable abstractions without losing compatibility with existing Terraform modules.

Layered architecture of CDKTF

Below is a concise, layered view of how CDKTF maps language constructs to Terraform execution:

How CDKTF works (workflow)

  1. Author infrastructure using your language of choice and CDKTF constructs.
  2. Synthesize the project with CDKTF tooling to generate Terraform configuration (JSON/HCL).
  3. Use the Terraform CLI against the generated configuration:
    • terraform init — initialize providers and backend
    • terraform plan — preview changes
    • terraform apply — apply changes
This workflow keeps Terraform’s proven execution model while letting developers express infrastructure in full-featured programming languages.
CDKTF bridges the gap between application developers and infrastructure operators: you gain the expressiveness and tooling available in general-purpose languages while retaining Terraform’s robust provider ecosystem and execution model.

Why this approach helps

  • Reuse and abstraction: Leverage language features (functions, classes, modules) to create higher-level constructs and shareable libraries.
  • Testability: Use existing unit and integration testing frameworks for infrastructure code.
  • Compatibility: Maintain full interoperability with Terraform providers, state management, and CLI workflows.
  • Incremental adoption: Synthesize to standard Terraform artifacts to interoperate with existing HCL modules and teams.

Summary

CDKTF allows teams to define infrastructure in languages they already know while producing standard Terraform configuration that benefits from Terraform’s planning, state management, and large provider catalog. The result is infrastructure automation that’s more approachable, testable, and extensible—without losing the strengths of Terraform.

Watch Video