Cloud Development Kit for Terraform (CDKTF)
The Cloud Development Kit for Terraform (CDKTF) allowed developers to define and provision infrastructure using familiar programming languages like Python, instead of HashiCorp Configuration Language (HCL). It provided access to the entire Terraform ecosystem, leveraging existing tooling for testing and dependency management. As of December 10, 2025, HashiCorp has officially deprecated CDKTF, ceasing maintenance and development. The project repository is archived, and no further updates, fixes, or improvements (including compatibility updates) will be made.
Warnings
- breaking CDKTF is officially deprecated as of December 10, 2025. HashiCorp will no longer maintain or develop the project, and no further updates, fixes, or compatibility changes will be provided.
- breaking Prior to reaching version 1.0, CDKTF followed semantic versioning where even minor version bumps could introduce breaking changes to APIs, generated provider bindings, and the synthesis process.
- gotcha Provider import paths changed significantly in version 0.13. Previously, providers might be imported directly from `cdktf_cdktf_provider_<provider_name>`. The correct pattern now is typically `from cdktf_cdktf_provider_<provider_name>.provider import <ProviderName>`.
- gotcha Mismatched versions between the `cdktf-cli` and the `cdktf` Python library can lead to subtle and confusing errors during synthesis or deployment.
- gotcha After adding or modifying Terraform providers/modules in `cdktf.json` or installing new provider Python packages, you must run `cdktf get`. This command generates the necessary CDK Constructs for Terraform providers and modules within your project.
Install
-
npm install --global cdktf-cli@latest -
pip install cdktf -
pip install cdktf-cdktf-provider-aws
Imports
- App
from cdktf import App
- TerraformStack
from cdktf import TerraformStack
- Construct
from constructs import Construct
- AwsProvider
from cdktf_cdktf_provider_aws.provider import AwsProvider
Quickstart
import os
from constructs import Construct
from cdktf import App, TerraformStack, TerraformOutput
from cdktf_cdktf_provider_aws.provider import AwsProvider
from cdktf_cdktf_provider_aws.s3 import S3Bucket
class MyStack(TerraformStack):
def __init__(self, scope: Construct, id: str):
super().__init__(scope, id)
AwsProvider(self, 'Aws', region=os.environ.get('AWS_REGION', 'us-east-1'))
bucket = S3Bucket(self, 'MyBucket',
bucket_prefix="my-unique-cdktf-bucket-",
tags={
"Environment": "Development",
"ManagedBy": "CDKTF"
}
)
TerraformOutput(self, 'bucket_name', value=bucket.id)
app = App()
MyStack(app, 'my-cdktf-aws-stack')
app.synth()