Configuration File
tfts uses a configuration file namedcdktf.json (or tfts.json) to manage project settings, providers, and modules.
Schema
The following fields are supported in the configuration file:| Field | Type | Description |
|---|---|---|
language | string | Must be set to "typescript". (Required) |
app | string | The command to run your application (e.g., "bun run main.ts" or "node main.js"). |
output | string | The directory where synthesized Terraform JSON will be stored. Default: "cdktf.out". |
codeMakerOutput | string | The directory where generated provider bindings will be stored. Default: ".gen". |
terraformProviders | string[] | An array of provider specifications (e.g., "hashicorp/aws@~> 5.0"). |
terraformModules | string[] | An array of module sources to generate bindings for. |
context | object | Optional key-value pairs for context variables. |
Example Configuration
cdktf.json
Environment Variables
You can override certain configuration settings using environment variables:CDKTF_OUTDIR: Overrides theoutputdirectory setting.CDKTF_CONTEXT_JSON: Provides context variables as a JSON string.
Advanced Examples
Using Context Variables
You can define context variables in your configuration file and access them in your code.cdktf.json
Custom Output Directories
If you want to separate your generated bindings from your source code:cdktf.json