Skip to content

About

Dependency Injection for CDKTF(Cloud Development Kit for Terraform) powered by projen.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

331 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version Release License

Dependency Injection for CDKTF

Note

Maintenance mode. HashiCorp sunset CDKTF and archived hashicorp/terraform-cdk on 2025-12-10 (last release 0.21.0). cdktf-injector keeps supporting cdktf >=0.20.3 <0.22 with bug and security fixes only. No new features are planned.

cdktf-injector is a dependency injection library for CDKTF (AWS Cloud Development Kit for Terraform).

If you are not familiar with cdktf and terraform yet or haven't heard of them before, this library may not be that so useful. That's totally cool, but I recommend you to have a look what they (cdktf and terraform) are or at least what's the concept of IaC. Those are really amazing.

There are two prerequisites for cdktf-injector

  • Terraform - Terraform must be on your PATH. See the Terraform install guide.

  • cdktf - A library for defining Terraform resources using programming constructs. Click here to get started. Or, simply type the following lines.

    mkdir your-project-name
    cd your-project-name
    npx cdktf-cli init --template="typescript" --local

Features

  • No decorator
  • No need to declare custom classes
  • No need to explicitly write dependencies

Installation

Using npm

npm install cdktf-injector --save

Using pnpm

pnpm add cdktf-injector

Using yarn

yarn add cdktf-injector

Requirements

Package Version
Node.js >= 22
cdktf (peer) >=0.20.3 <0.22
constructs (peer) ^10.3.0

Note : cdktf supports multiple languages, such as TypeScript, Python, Java, C# and Go. However, according to Typescript restriction of jsii, which I originally wanted to use to power my lib and what cdktf depends on, it does not allow using Parameterized Types(aka: Generics). And as far as I know, there is no other decent way to implement dependency injection without using generics or decorators. In brief, cdktf-injector is currently available only in Node.js env. I'm looking forward to making this lib support multiple languages soon.


Documentation


Development

The project is managed by projen with pnpm. Edit .projenrc.ts and run pnpm projen instead of editing generated files (package.json, tsconfig*.json, workflows, ...).

pnpm install
pnpm build   # compile, test, package
pnpm test    # jest + eslint
pnpm docgen  # TypeDoc into docs/

The devcontainer (.devcontainer/) installs Node.js and Terraform (via the ghcr.io/devcontainers/features/terraform feature).

docs/ is TypeDoc output regenerated by pnpm docgen; do not edit it by hand. Work items are tracked as markdown under issues/, not GitHub Issues.

About

Dependency Injection for CDKTF(Cloud Development Kit for Terraform) powered by projen.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages