HashiCorp previews Cloud Development Kit for Terraform

HashiCorp has released a tech preview of its Cloud Development Kit for Terraform, the company’s infrastructure-as-code provisioning tool, allowing users to write Terraform configurations in languages other than Terraform’s native one.

CDK for Terraform 0.7 enables developers to use more familiar programming languages to define cloud infrastructure and provision it through HashiCorp Terraform, without having to learn HashiCorp Configuration Language (HCL).

The list of languages currently supported includes TypeScript, Python, Java, C# and experimental support for Go.

Key improvements in CDK for Terraform 0.7 include AWS CDK compatibility, a simplified provider API and improved documentation.

The AWS CDK compatibility feature allows developers to use resources from both the Terraform and AWS CDK ecosystems in their CDK for Terraform code. A new experimental AwsTerraformAdapter allows AWS CDK (v2) constructs to be deployed in CDK for Terraform code to provision resources using Terraform. Constructs can be regarded as cloud components and are the basic building blocks of AWS CDK applications.

However, HashiCorp warns that the AwsTerraformAdapter is still at the technical preview stage and is not ready for production deployments.

The provider API is responsible for downloading the providers and modules that are defined in a user application and generating CDK constructs for them. In CDK for Terraform 0.7, the interface with this API has been updated to make the constructs that are returned easier to access and work with.

According to HashiCorp, the API previously translated any block to an array of a certain type, both in configuration and as properties on the resource/data source instances. With the improved API in CDK for Terraform 0.7, these blocks will return just the type, instead of an array of a certain type.

HashiCorp warns that CDK for Terraform 0.7 contains breaking changes that will require code updates for namespacing AWS provider resources, as well as the provider API updates just described. Users are directed to the changelog and 0.7 Upgrade Guide for details.

Meanwhile, the product documentation for CDK for Terraform has now been updated and moved from the GitHub repository to Terraform.io. On the new documentation site, users can browse by filtering for specific reference topics and read more about the architecture of CDK for Terraform.

CDK for Terraform includes two packages. One is a command line interface that allows users to run commands to initialise, import, and synthesise CDK for Terraform code, while the other is a library for defining Terraform resources using programming constructs.

Terraform itself, which finally reached an official version 1.0 in June, manages IT resources such as public cloud infrastructure and private cloud infrastructure, using declarative configurations.