This is highly opinionated CDKTF template for Typescript that I use for myself to ease my IaaC development and have been using this in production environments without any hitch.
If you want to see a real-life example of how this template works, visit this repo.
- Control your Terraform Cloud / Enterprise resources within this codebase.
- Autoload all the stacks and its resources and data instead of manually importing them from somewhere.
- A minimal dependency injector:
- Refer to stacks using the
@Stack()
decorator (usable within aTerraformStack
class). - Refer to resources within the stack with the
@Resource(id: string)
decorator. - Refer to data within the stack with the
@Data(id: string)
decorator.
- Refer to stacks using the
- Define resource or datum metadata from a different method instead of the
constructor(...)
with the@Constructor()
decorator. - Define Terraform Cloud workspace with the
@Workspace(name: string, config?: WorkspaceConfig)
decorator.
- Terraform:
>=1.5
- CDKTF:
>=0.17
- NodeJS:
>=18.0
- Typescript:
>=5.1
- Create a template from this repo.
- Update the value for
projectId
inside thecdktf.json
file. You can generate a random UUID from here. - Install your required providers by running
cdktf provider add <provider...>
. - Create your stacks.
- Run
cdktf apply '*' --auto-approve
. - ???
- Profit.
Tests are for pussies. Directly raw-dog your infrastructure like a boss!
On a serious note, I didn't get the time to create tests for this project.
Hopefully in the near future?
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.