How to build and run a CDKTF application by using local provider for testing

Let’s say I add a new attribute to a resource schema or a new resource or make some logical change in my Terraform provider and I then build a binary for it on my machine. I now want to test this provider with CDKTF on my machine.
How do I tell my CDKTF application to use this local binary to generate bindings and for all execution instead of downloading the provider from Terraform registry?

I have tried updating .terraformrc and cdktf.json with path to the local provider binary but nothing seems to work and the latest version of the provider is always downloaded from the registry. Also, the documentation isn’t clear for exact steps to do this. All I see is this Providers - CDK for Terraform | Terraform | HashiCorp Developer where it still isn’t clear what exactly I need to do.

Could you please share exact steps in order to achieve this on MacOS?

Hi @maastha, can you say more about what is not clear? Did you try CLI Configuration | Terraform | HashiCorp Developer, and/or CLI Configuration | Terraform | HashiCorp Developer?

Just in case this turns out to be a bug, which version of Terraform CLI and CDK tools are you running? Thanks!

As @CraigW mentioned, Development Overrides for Provider Developers is indeed what you’re looking for.

In order to build bindings, the process is straightforward:

  • Update your .terraformrc file according to the above link, replacing the name of the provider and the path to the built binary.
  • Add the provider to cdktf.json
  • Run cdktf get (you might have to use --force if you already have them generated)

This should result in updated bindings locally. I reproduced it just now on my Mac with the latest CDKTF release to be certain. I can generate the bindings with changes I introduced.

Can you provide more information to help diagnose what’s going on?