IaC Series: CDK for Terraform (CDKTF) - It finally went GA!

IaC Series: CDK for Terraform (CDKTF) - It finally went GA!

 

Table of Contents

 

CDKTF... Wait, what?

HashiCorp has been one of the most popular Infrastructure as Code tools in the market for over a couple of years now. The ease and simplicity of using a JSON-like language, known as HCL (HashiCorp Configuration Language), is one of the key features which attracts most of the users and customers.

Although it provides additional data structures and programming constructs, for the programmers and developers, it's not interesting enough since in certain ways, it restricts them from using the extensive capabilities like other general-purpose programming languages do.

AWS CDK, on the other hand, became one of the most develop-friendly IaC tools in recent times and got a lot of popularity. It allowed users to build their infrastructure using familiar programming languages, like Python, TypeScript, JavaScript, Java, and C#. But, the only drawback it has, is that it can be used on the AWS Cloud Platform only.

 

 

What were the "Issues" then?

In principle, the major issues the IaC users were facing were:

  • Terraform is compatible with all the cloud platforms and on-premises, but is not the best for developers

  • AWS CDK is developer-friendly but only available on AWS Cloud

So, to address these issues, HashiCorp collaborated with AWS CDK to build CDKTF (Cloud Development Kit for Terraform). They had been working on this for over 2 years, and now they have released the first generally available (GA) version 0.12 of CDKTF on August 1, 2022, making it available for use in production.

 

Official Announcement by HashiCorp: www.hashicorp.com

Official Announcement by AWS (English): aws.amazon.com

Official Announcement by AWS (Japanese): aws.amazon.com

 

 

What does CDKTF bring to the table?

  1. Configure infrastructure in a programming language of choice

    The developers can use CDKTF for the infrastructure configuration and provisioning without the need to switch from the application development language and environment using a familiar syntax. It enables the infrastructure and application teams to collaborate and work together, eliminating the differences and making the process easier than before. CDKTF provides support for programming languages, like TypeScript, Python, C#, Java, and the new buddy in the league, Go.

    This allows users to use all the features of programming languages and data from other sources for augmenting Terraform configuration.

    CDKTF, in the background, translates and generates a terraform configuration in JSON and automatically applies that to provision the infrastructure.

     

  2. Use existing Terraform capabilities

    Terraform retains all the existing functionalities that it used to provide, like Modules, Data Sources, Backends, etc. This helps in keeping the fundamental features of Terraform intact, making it easier for the existing users.

     

  3. Interoperability between HCL and CDKTF

    CDKTF also takes care of the need to transition from HCL to CDKTF and vice versa. This feature really helps the existing users of Terraform to migrate to CDKTF and start using it.

     

 

Who can use CDKTF?

Although CDKTF has a lot of potential to be chosen for the project, but there are a couple of things to be kept in mind before kicking off this journey. So, if you have checked the following things, you are good to go:

  • If you have no knowledge of HCL, and prefer or need to use general-purpose programming language.

  • If you want to create abstractions in the configuration, which can generate reusable infrastructure.

  • If you can do your own troubleshooting and problem resolution since it's open-source and there's no commercial support available.

If you feel that these things are not much of a trouble for you, then what are you waiting for? It's the time you should start using CDKTF!

 

 

Conclusion

CDKTF (CDK for Terraform) is really something to look out for if you have been using Terraform or AWS CDK for infrastructure provisioning and management. Though it's just the first GA release, we can expect some limitations, feature lags, or even bugs, but it will improve and grow over a period of time.

 

Article by: Atul Anand, Fellow

JTP Co., Ltd.