DEV Community

Sebastian Korfmann
Sebastian Korfmann

Posted on

CDK for Terraform 0.2

The CDK (Cloud Development Kit) for Terraform allows developers to use familiar programming languages to define cloud infrastructure and provision it through HashiCorp Terraform.

We released CDK for Terraform 0.2 recently. Besides from various smaller and bigger improvements, the focus was on iterating on the support for Terraform modules.

Up until now, we did support generating code bindings for Terraform Modules which are published on the Terraform Registry only. The Terraform Registry API provides all the metadata we needed to generate code straight from the API response without having to process the Terraform module sources.

With the new 0.2 release, we changed the internal implementation for fetching modules to support all sources which Terraform supports. This includes Modules from Github, HTTP and local disk. Since we're not relying on the Terraform Registry API anymore, we had to come up with our own solution to extract the relevant metadata.

The main challenge here was: CDK for Terraform is primarily written in Typescript, while most of the Terraform ecosystem relies on Go. To bridge this gap, WebAssembly came to the rescue. It enabled us to leverage existing tools from the Go community by building a thin wrapper in Typescript. More details about the learnings from that journey in one of the next posts :)

In the meantime, please go ahead and checkout the latest release of CDK for Terraform. We're always looking for feedback and ideas to drive the product forward.

Top comments (1)

Collapse
 
danielmschmidt profile image
Daniel Schmidt

Nice solution to leverage web assembly here!