# CDK Terrain (CDKTN) ## Documentation ### Getting Started - [CDK Terrain](https://cdktn.io/docs/index.md): CDK Terrain (CDKTN) lets you use familiar programming languages to define and provision infrastructure. - [Use CDKTN with AI Agents](https://cdktn.io/docs/ai-agents.md): Connect your AI coding agent (Claude Code, Cursor, VS Code, and others) to the hosted CDK Terrain MCP server so it answers from the current docs instead of stale or unrelated knowledge. ### Overview - [CDKTN Community - CDK Terrain](https://cdktn.io/docs/community.md): Resources to help you contribute to the codebase, submit issues, ask questions, and see our roadmap. - [Telemetry - CDK Terrain](https://cdktn.io/docs/telemetry.md): The CDK Terrain CLI can report anonymous usage metrics and crash reports to the project's Sentry. Learn what it sends and how to turn each one off. #### Concepts - [CDKTN Architecture - CDK Terrain](https://cdktn.io/docs/concepts/cdktn-architecture.md): Key CDK Terrain components and application structure. - [HCL Interoperability - CDK Terrain](https://cdktn.io/docs/concepts/hcl-interoperability.md): Use configurations written in HCL and configurations written in CDK for Terraform together to define and provision infrastructure. - [Constructs - CDK Terrain](https://cdktn.io/docs/concepts/constructs.md): “Constructs are classes that allow you to reuse existing configurations. Learn about using constructs in your CDKTN application and how to publish custom constructs.” - [Providers - CDK Terrain](https://cdktn.io/docs/concepts/providers.md): Providers allow Terraform to communicate with external APIs. Learn to define providers in a CDK Terrain application. - [Resources - CDK Terrain](https://cdktn.io/docs/concepts/resources.md): Resources describe one or more infrastructure objects, like virtual networks, compute instances, and DNS records. Define resources in a CDK Terrain application. - [Modules - CDK Terrain](https://cdktn.io/docs/concepts/modules.md): Use both public and private modules in your CDKTN application to reuse existing configurations. - [Data Sources - CDK Terrain](https://cdktn.io/docs/concepts/data-sources.md): Use data sources to allow Terraform to use external data, function output, and data from other configurations. - [Variables and Outputs - CDK Terrain](https://cdktn.io/docs/concepts/variables-and-outputs.md): Input variables, local values, and output values allow you to request and publish named values. - [Functions - CDK Terrain](https://cdktn.io/docs/concepts/functions.md): Learn when to use built-in Terraform functions to transform or combine values. - [Iterators - CDK Terrain](https://cdktn.io/docs/concepts/iterators.md): Iterators let you loop over a collection of values that are only available at runtime. - [Remote Backends - CDK Terrain](https://cdktn.io/docs/concepts/remote-backends.md): Configure a remote backend where Terraform can store infrastructure state files remotely. - [Aspects - CDK Terrain](https://cdktn.io/docs/concepts/aspects.md): Aspects apply an operation to all constructs in a given scope. You can use them for mutation (e.g., add resource tags) and validation (e.g., check encryption). - [Mixins - CDK Terrain](https://cdktn.io/docs/concepts/mixins.md): Mixins apply a reusable feature to a specific construct with construct.with(). Use them to configure individual resources; use Aspects for scope-wide sweeps. - [Assets - CDK Terrain](https://cdktn.io/docs/concepts/assets.md): Asset constructs manage assets for resources that need them, such as template_file, S3 bucket objects, or Lambda function archive files. - [Tokens - CDK Terrain](https://cdktn.io/docs/concepts/tokens.md): Tokens allow CDK Terrain to resolve programming language types to Terraform language syntax. - [Stacks - CDK Terrain](https://cdktn.io/docs/concepts/stacks.md): Use stacks to specify separate collections of infrastructure for different environments, like test and production. #### Examples and Guides - [Examples and Guides - CDK Terrain](https://cdktn.io/docs/examples-and-guides/examples.md): Resources to help you learn CDK Terrain, including example projects in Typescript, Java, Python, C#, and Go. - [Refactoring - CDK Terrain](https://cdktn.io/docs/examples-and-guides/refactoring.md): Refactor stacks as your CDKTN application grows in size and complexity. #### Create and Deploy - [Project Setup - CDK Terrain](https://cdktn.io/docs/create-and-deploy/project-setup.md): Build a CDKTN application from a template or existing HCL project, and configure storage for Terraform state. - [Configuration - CDK Terrain](https://cdktn.io/docs/create-and-deploy/configuration-file.md): Use the cdktf.json file to customize configuration settings and define the providers and modules to use with your application. - [Best Practices - CDK Terrain](https://cdktn.io/docs/create-and-deploy/best-practices.md): Build robust applications for production use cases. How to manage secrets, build constructs, design stacks, and more. - [Environment Variables - CDK Terrain](https://cdktn.io/docs/create-and-deploy/environment-variables.md): There are some environment variables that can be used to configure the behavior of CDKTN. - [Connect to HCP Terraform / Terraform Enterprise - CDK Terrain](https://cdktn.io/docs/create-and-deploy/hcp-terraform.md): Use HCP Terraform with CDKTN to store Terraform state remotely, manage secrets, apply policies, and more. - [Deployment Patterns - CDK Terrain](https://cdktn.io/docs/create-and-deploy/deployment-patterns.md): Continuously deploy your applications with CDKTN. - [Performance - CDK Terrain](https://cdktn.io/docs/create-and-deploy/performance.md): The faster you can synthesize your CDKTN code, the faster you can deploy it. Learn how to optimize your CDK Terrain performance. - [Remote Templates - CDK Terrain](https://cdktn.io/docs/create-and-deploy/remote-templates.md): Templates allow you to scaffold a new CDK Terrain Project. Learn to create your own template. - [[deprecated] AWS Adapter](https://cdktn.io/docs/create-and-deploy/aws-adapter.md): [technical preview] Use AWS CDK (v2) constructs in CDK for Terraform projects. #### Custom Constructs - [Construct Design | CDK Terrain](https://cdktn.io/docs/develop-custom-constructs/construct-design.md): Write highly configurable construct classes that provide guidance for a wide range of use cases. - [Distributing and Consuming Constructs | CDK Terrain](https://cdktn.io/docs/develop-custom-constructs/publishing-and-distribution.md): Translate custom constructs to multiple languages. Use the projen project to quickly package and distribute constructs to public or private registries. #### Test and Debug - [Unit Tests - CDK Terrain](https://cdktn.io/docs/test/unit-tests.md): Write assertions and snapshot tests for your CDK Terrain application. - [Debugging - CDK Terrain](https://cdktn.io/docs/test/debugging.md): Turn on logging and troubleshoot problems in your CDKTN application. #### CLI Reference - [CLI Configuration - CDK Terrain](https://cdktn.io/docs/cli-reference/cli-configuration.md): Install and configure the CDKTN Command Line Interface. - [CLI Commands - CDK Terrain](https://cdktn.io/docs/cli-reference/commands.md): Use the CLI to initialize a new project, deploy your CDKTN app, generate Terraform configuration files, and more. #### Release - [Changelog](https://cdktn.io/docs/release/changelog.md): The full CDK Terrain changelog on GitHub, with every bug fix, feature, and breaking change by release. ##### What's New - [What's New in CDK Terrain](https://cdktn.io/docs/release/index.md): The latest CDK Terrain release at a glance, the feature flags you can enable today, and links to the release notes of earlier versions. ###### v0.25 - [What's New in CDK Terrain v0.25](https://cdktn.io/docs/release/whats-new/v0-25/index.md): Everything CDK Terrain v0.25.0 introduced: synth-time validation against targetVersions, an asset staging and bundling pipeline, registry-aware provider resolution, usage metrics with consent, a typescript-pnpm template, tsx and TypeScript 6 in the TypeScript template, and a Node.js 22.23.4 minimum. - [What's New: Synth-Time Validation Against Target Versions](https://cdktn.io/docs/release/whats-new/v0-25/synth-time-validation.md): CDK Terrain v0.25 validates moved blocks, import blocks, terraform_data, and the cloud backend against the targetVersions your project declares, and synthesis no longer runs the Terraform or OpenTofu binary. - [What's New: Asset Staging and Bundling](https://cdktn.io/docs/release/whats-new/v0-25/asset-pipeline.md): CDK Terrain v0.25 adds an asset pipeline to TerraformAsset: exclusions, custom ignore strategies, extra hash inputs, and a bundler extension interface that can build a directory or a single-file artifact. - [What's New: Registry-Aware Provider Resolution](https://cdktn.io/docs/release/whats-new/v0-25/registry-resolution.md): CDK Terrain v0.25 resolves providers, versions, pre-built packages, and generated documentation links from the registry your project targets, so OpenTofu projects no longer need fully qualified provider sources. - [What's New: Usage Metrics and Consent](https://cdktn.io/docs/release/whats-new/v0-25/usage-telemetry.md): CDK Terrain v0.25 stops sending usage data to HashiCorp Checkpoint. The CLI reports aggregated usage metrics to the project's own Sentry, behind a new sendUsageTelemetry consent flag in cdktf.json. ###### v0.24 - [What's New in CDK Terrain v0.24](https://cdktn.io/docs/release/whats-new/v0-24/index.md): Everything CDK Terrain v0.24.0 introduced: function validation on by default, a Node.js 22.19 minimum, symlink-preserving assets, undici for CLI HTTP requests, canonical asset hashes, ephemeral resources, provider-defined functions, write-only attributes, and pre-built provider updates. - [What's New: Function Validation On by Default](https://cdktn.io/docs/release/whats-new/v0-24/function-validation-default.md): CDK Terrain v0.24.0 validates the Terraform functions you use against your declared targetVersions in every project, and removes the validateFunctionVersions feature flag. - [What's New: Ephemeral Resources, Provider Functions, and Write-Only Attributes](https://cdktn.io/docs/release/whats-new/v0-24/plugin-protocol.md): CDK Terrain v0.24.0 generates bindings for ephemeral resources, provider-defined functions, and write-only attributes, and validates their use against your declared targetVersions. - [What's New: Canonical Asset Hashes](https://cdktn.io/docs/release/whats-new/v0-24/canonical-asset-hashes.md): The canonicalAssetHashes feature flag makes asset hashes track every property of the emitted asset, and archives are now emitted byte-reproducibly. ###### v0.23 - [What's New in CDK Terrain v0.23](https://cdktn.io/docs/release/whats-new/v0-23/index.md): Everything CDK Terrain v0.23.0 through v0.23.4 introduced: runtime support drops, mixins, declared target versions, function availability validation, S3-native state locking, faster synthesis, and pre-built provider updates. - [What's New: Mixins](https://cdktn.io/docs/release/whats-new/v0-23/mixins.md): CDK Terrain v0.23.0 raised the constructs peer dependency to 10.6, which adds the IMixin interface and construct.with() for applying reusable behavior to a single construct. - [What's New: Declared Target Versions](https://cdktn.io/docs/release/whats-new/v0-23/target-versions.md): CDK Terrain v0.23.4 added the targetVersions field to cdktf.json, so synth-time validations check features against the Terraform and OpenTofu versions your project declares instead of running a binary. - [What's New: Function Availability Validation](https://cdktn.io/docs/release/whats-new/v0-23/function-availability.md): CDK Terrain v0.23.4 validates the Terraform functions you use against your declared targetVersions, and the Fn bindings cover Terraform and OpenTofu. - [What's New: S3-Native State Locking](https://cdktn.io/docs/release/whats-new/v0-23/s3-native-locking.md): The S3 backend can now lock state with a native lock file via the useLockfile field, removing the need for a separate DynamoDB table. ###### v0.22 - [What's New in CDK Terrain v0.22](https://cdktn.io/docs/release/whats-new/v0-22/index.md): CDK Terrain v0.22 is the first release under the CDK Terrain name: packages renamed from cdktf to cdktn, Maven Central and NuGet.org publishing restored, and pre-built providers moved to cdktn-io. ##### Upgrade Guides - [Upgrading to CDKTN Version 0.25](https://cdktn.io/docs/release/upgrade-guide-v0-25.md): Upgrade your CDK Terrain (cdktn) project from v0.24 to v0.25. This release requires Node.js 22.23.4, validates moved, import, terraform_data, and cloud against targetVersions at synth time, changes the asset packaging interface, and replaces HashiCorp Checkpoint telemetry. - [Upgrading to CDKTN Version 0.24](https://cdktn.io/docs/release/upgrade-guide-v0-24.md): Upgrade your CDK Terrain (cdktn) project from v0.23 to v0.24. This release requires Node.js 22.19.0, always validates Terraform function usage, preserves symlinks in assets, and switches the CLI's HTTP client to undici. - [Upgrading to CDKTN Version 0.23](https://cdktn.io/docs/release/upgrade-guide-v0-23.md): Upgrade your CDK Terrain (cdktn) project to v0.23. This release drops support for end-of-life language runtimes — Go 1.18–1.24, Python 3.8, and TypeScript below 4.5 — and warns that Node.js 20.x support is ending. - [Migrating to CDKTN](https://cdktn.io/docs/release/upgrade-guide-v0-22.md): Migrate your CDK for Terraform (cdktf) project to CDK Terrain (cdktn) v0.22 with updated packages, imports, and CLI commands for TypeScript, Python, Go, Java, and C#. - [Upgrading to CDKTF Version 0.19](https://cdktn.io/docs/release/upgrade-guide-v0-19.md): Potential provider naming collision with new instance function `moveTo` - [Upgrading to CDKTF Version 0.18](https://cdktn.io/docs/release/upgrade-guide-v0-18.md): Python performance improvements disable root-level provider imports - [Upgrading to CDKTF Version 0.17](https://cdktn.io/docs/release/upgrade-guide-v0-17.md): Breaking changes to AWS Quicksight resources and removal of deprecated feature flags - [Upgrading to CDKTF Version 0.15](https://cdktn.io/docs/release/upgrade-guide-v0-15.md): Minimum version of Terraform increased to 1.2, some interfaces / classes renamed for C#, Java, and Go - [Upgrading to CDKTF Version 0.13](https://cdktn.io/docs/release/upgrade-guide-v0-13.md): Introducing namespaces for generated providers - [Upgrading to CDKTF Version 0.12](https://cdktn.io/docs/release/upgrade-guide-v0-12.md): We simplified recursive attribute types to have shorter names - [Upgrading to CDKTF Version 0.11](https://cdktn.io/docs/release/upgrade-guide-v0-11.md): We changed how assignable list and map properties are accessed after resource construction - [Upgrading to CDKTF Version 0.10](https://cdktn.io/docs/release/upgrade-guide-v0-10.md): We changed how lists of computed attributes work to allow referencing the whole list - [Upgrading to CDKTF Version 0.9](https://cdktn.io/docs/release/upgrade-guide-v0-9.md): We changed some provider bindings to work better across all languages. - [Upgrading to CDKTF Version 0.7](https://cdktn.io/docs/release/upgrade-guide-v0-7.md): Update your import statements for the AWS provider and learn to migrate your projects. - [Upgrading to CDKTF Version 0.6](https://cdktn.io/docs/release/upgrade-guide-v0-6.md): Version 0.6 uses constructs version 10. Understand the API changes and learn how to migrate your projects. ## Tutorials ### Basic - [Install CDK Terrain and run a quick start demo](https://cdktn.io/docs/tutorials/install.md): Install the CDK Terrain CLI, initialize a project in your preferred language, and deploy the Docker-based quick start container. - [Build AWS infrastructure with CDK Terrain](https://cdktn.io/docs/tutorials/build-aws.md): Provision an AWS EC2 instance with CDKTN in your preferred language, store state in HCP Terraform, then update the stack by adding a Name tag. - [Deploy Lambda functions with TypeScript and CDK Terrain](https://cdktn.io/docs/tutorials/lambda-functions.md): Deploy two AWS Lambda stacks from a single CDKTN app, package Lambda artifacts with TerraformAsset, and manage each stack independently. - [Deploy an application with CDK Terrain](https://cdktn.io/docs/tutorials/deploy-applications.md): Deploy a Kubernetes app with CDKTN on a local kind cluster, refactor into reusable constructs with tests, ship custom images, and run multiple stacks. - [API Reference (926 pages)](https://cdktn.io/docs/_llms/api-reference.txt): Documentation for API Reference. ## Optional - [Project](https://cdktn.io) - [GitHub](https://github.com/open-constructs/cdk-terrain) - [Providers](https://provider-dashboard.cdktn.io/) > The links below point to documentation indexes. Follow each `/_llms/` index recursively until you reach documentation pages. ## Indexes - [API Reference (926 pages)](https://cdktn.io/docs/_llms/api-reference.txt): Documentation for API Reference. - [API Reference / TypeScript (185 pages)](https://cdktn.io/docs/_llms/api-reference/type-script.txt): Documentation for API Reference / TypeScript. - [API Reference / C# (185 pages)](https://cdktn.io/docs/_llms/api-reference/c.txt): Documentation for API Reference / C#. This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.