Ever wished you could just use typescript to write your infrastructure? You may or may not have heard about the release of the terraform cdk (short for cloud development kit). By Julian Krispel-Samsel.
CDK (Cloud Development Kit) for Terraform allows developers to use familiar programming languages to define cloud infrastructure and provision it through HashiCorp Terraform.
The article then describes how:
- To generate the boilerplate
- Adding a provider package and importing modules from it
- Adding a lambda function to our stack
- Deploying your stack
The article prvides step by step instruction for deploying serverless lambda function to AWS, including IAM Role configuration. cdktf
compiles your javascript/typescript modules into terraforms alternative JSON configuration syntax. This is an extremely powerful feature of terraform’s design since it can be a compile target not just for javascript and typescript, but any kind of language. How exciting!