Prerequisites
Before you begin, make sure you have:- Node.js 18+ or Bun installed
- Terraform CLI installed (installation guide)
Step 1: Create a new project
Create a new directory and initialize a TypeScript project:Step 2: Install tfts
Step 3: Create configuration file
Create acdktf.json file in your project root:
Step 4: Generate provider bindings
Generate TypeScript bindings for your providers:.gen directory with fully-typed provider classes.
Step 5: Write your infrastructure
Create amain.ts file:
Step 6: Synthesize and deploy
Synthesize Terraform JSON configuration:cdktf.out directory with your Terraform configuration.
Navigate to the stack directory and deploy:
Using the CLI
tfts provides commands to streamline the workflow:Next steps
Core Concepts
Learn about App, Stack, and Constructs.
CLI Reference
Explore all available CLI commands.
Variables and Outputs
Work with Terraform variables and outputs.
Functions
Use Terraform functions in your code.