CDK for Terraform 0.11 Introduces New Provider Command and More

Cloud Development Kit for Terraform (CDKTF) 0.11 introduces an easier way to add providers to your application and improvements to the debugging process.

We are excited to announce the release of Cloud Development Kit for Terraform (CDKTF) 0.11. With CDK for Terraform, you can write Terraform configurations in your choice of C#, Python, TypeScript, or Java (with experimental support for Go), and still benefit from the full ecosystem of Terraform providers and modules.

Key improvements in CDK for Terraform 0.11 include:

  • New provider add command: This new CLI workflow does the work for you to check whether or not a prebuilt package exists for the provider that you want to use. If a prebuilt package exists, it will be installed for you. If not, the get command will be run in the background to generate your provider resources classes.
  • Improved debugging tools: Relevant version information is now included in CLI error messages.

»New CLI Workflow to Add Providers

One of the benefits of using CDKTF is that you can import any Terraform provider to use with your application. 0.11 adds a new command, cdktf provider add to allow you to quickly and easily add prebuilt and local provider packages to your CDKTF application.

Prior to 0.11, there were two ways to add a provider to your project: define the provider in your cdktf.json file and run cdktf get to locally generate the provider resource classes, or run a package manager command, like npm install for TypeScript applications, to install a prebuilt provider package. Prebuilt packages are faster to install, which makes them a better option if they are available for the providers you wish to use.

With the newprovider addcommand, you no longer need to check whether or not a prebuilt package exists for the provider that you want to use. If a prebuilt package exists, it will be installed for you. If no prebuilt package exists, cdktf get will run in the background to automatically extract the schema from the Terraform provider to generate the necessary classes for your application. This new command works for all supported languages. For example, it will run an npm install for a TypeScript application or dotnet add for a C# application.

Thegetcommand will continue to be supported (and should still be used for generating classes for Terraform modules), but the new option to run cdktf provider add allows you to benefit from the speed of working with prebuilt provider packages, without having to do any of the lookup yourself.

»Improved Tools for Debugging

0.11 adds a debug command that collects all relevant version information, and uses that information to print helpful debugging messages to the CLI when an error is thrown. Additional information on troubleshooting errors can be found on the new Debugging documentation page.

»Other Improvements

The CDK for Terraform CHANGELOG contains a comprehensive list of additional enhancements and bug fixes. Please note that CDKTF 0.11 contains breaking changes that may require code updates. See the CHANGELOG and 0.11 Upgrade Guide for details.

This release also includes improvements to working with lists, building on work first released in 0.10. Generated provider code bindings have been improved to allow referencing list attributes as a whole list, instead of just individual items of that list. In 0.10 we released this improvement for computed, i.e. read-only, lists, but it is now available for all lists.

Two new documentation pages were also published with this release, to share more information about debugging and best practices.

»Try CDK for Terraform

If you’re new to the project, the tutorials for CDK for Terraform on HashiCorp Learn are the best way to get started, or dive deeper into our documentation beginning with this overview of CDKTF.

Whether you’re experimenting or actively using CDK for Terraform, we’d love to hear from you. Please file any bugs you encounter, let us know about your feature requests, and share other questions, thoughts, and experiences in the CDK for Terraform discussion forum.

Sign up for the latest HashiCorp news

By submitting this form, you acknowledge and agree that HashiCorp will process your personal information in accordance with the Privacy Policy.