Cdktf and in-house providers

I need to use version 0.6.2 of the libvirt provider which is not available on the Terraform registry. I created an image with the provider binary in the location that TF_PLUGIN_CACHE_DIR is set to by default.

/ # tree ~/.terraform.d/


└── plugin-cache

    └── dmacvicar

        └── libvirt

            └── 0.6.2

                └── linux_amd64

                    └── terraform-provider-libvirt


5 directories, 1 file

However when I run cdktf get I recv the following error. It seems like cdktf-cli is attempting to reach out to the registry anyhow. Is there any way to have it generate the constructs without fetching anything or checking anything external? Is there a manual procedure I could follow to just generate the constructs?
Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider

dmacvicar/libvirt: provider registry []( does not have a

provider named [](

Error: non-zero exit code 1

at ChildProcess.<anonymous> (/usr/lib/node_modules/cdktf-cli/lib/util.js:99:27)

at Object.onceWrapper (events.js:421:26)

at ChildProcess.emit (events.js:314:20)

at maybeClose (internal/child_process.js:1022:16)

at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

I am using version 0.1.0 of cdktf-cli.

Thank you,

Hi @kyleroot!

I think this is a Terraform-level thing rather than a CDK-level thing: the cache directory you populated here is only an optimization to avoid re-fetching binaries you’ve fetched before if the provider version selection happens to select the same version as you were previously using.

To tell Terraform that you want a local directory to be treated as authoritative for a particular provider (so Terraform won’t try to access the origin registry to discover available versions), you can put the extracted package in one of the implied local mirror directories. On startup Terraform scans all of those directories to see which providers appear there, and then behaves as if you’d written a CLI configuration which calls for each of those providers to be installed from local disk only.

(You can also configure installation methods explicitly, which would override the default search behavior I’ve described above, but for your use-case I think just moving the structure you created from the cache directory into one of the local mirror directories would be the easiest path forward.)

Thanks so much! That was exactly the problem, I moved the plugin to ~/.terraform.d/plugins and everything worked.