This repo contains a couple reusable libraries and example stacks that highlight CDKTF features and patterns.
cdktf-cli supports creating stacks based on a variety of built-in templates. Support for creating stacks based on remote templates was also added recently, but I have some convenient Makefile commands for these common operations.
Here's how to create a new stack.
make init NAME=mystack
cd stacks/mystack
make install
We have a template for creating new Python modules in the lib directory. These provide re-usable compontents for importing into stacks. Here's how to create one.
make library NAME=mylib
example_cdktf_env
contains the ExampleStack, which can be used to derived new
classes using inheritance. It automatically configures some common patterns,
such as state management and the AWS provider.
example_s3
is a trivial example of a reusable Python module that can be
imported into stacks.
cdk-state demonstrates how to setup S3 and DynamoDB for Terraform state
management for use with the ExampleStack
class.
The example-site
stack is very simple deplyoment of a static website hosted
on S3. The S3 bucket could have easily been created within the stack, but
it demonstrates the use of inheriting the ExampleStack
class and the reusable
example_s3
module.