Skip to main content
The CDK Terrain (CDKTN) CLI allows you to initialize a new CDKTN project, adjust project settings, synthesize your infrastructure into Terraform configuration files, deploy your CDKTN application, and more. You can also use some Terraform CLI commands like terraform apply and terraform destroy directly, but we recommend using the available cdktn cli commands where possible.
CDKTN works with both Terraform and OpenTofu. To use OpenTofu, set the TERRAFORM_BINARY_NAME=tofu environment variable. Refer to Environment Variables for details.

Install

Use

Help output:

CI Environment

If you are running the CLI in an automated environment, you can force the dynamic CLI output rendering to be static by setting the CI environment variable to true.

Configuration File

You can configure the behavior of the Terraform CDK CLI by modifying the cdktf.json file in your project root directory. Refer to the cdktf.json documentation for more detail on how you can supply custom configuration settings for your application. You can also declare the Terraform and OpenTofu versions your project targets and optionally have diff, deploy, and destroy verify the installed binary against them; see Declare Target Runtimes.

Telemetry

The CDKTN CLI (cdktn-cli interacts with a HashiCorp service called Checkpoint to report project metrics such as cdktn version, project language, provider name, platform name, and other details that help guide the project maintainers with feature and roadmap decisions. The code that interacts with Checkpoint is part of the CDK Terrain CLI. The use of Checkpoint is completely optional. Refer to the telemetry documentation for more information about Checkpoint and you can disable it if desired.