cdktf destroy fails with "Error: Could not load plugin" and "Plugin reinitialization required"
Fixes the cdktf destroy/deploy failure where Terraform cannot load provider plugins because init state is stale. Covers re-running terraform init in the stack output directory or cleaning and re-synthesizing. Use when destroy or deploy fails with Could not load plugin. Not for provider source errors.
TL;DR
Reinitialize the working directory: cd cdktf.out/stacks/[stack] && terraform init, then re-run cdktf destroy. If that fails, clean .gen and cdktf.out and re-synth first.
The error
Error: Could not load plugin
Plugin reinitialization required. Please run "terraform init".
Plugins are external binaries that Terraform uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.Fix it
cd cdktf.out/stacks/[stack-name].- Run
terraform initto reinstall the provider plugins. - Re-run
cdktf destroy(ordeploy) from the project root. - If init still fails, the generated config is stale:
rm -rf .gen cdktf.out,cdktf get,cdktf synth, then destroy.
Expected result: Terraform loads the plugins and destroy proceeds.
When to use this
cdktf destroyorcdktf deployfails with "Could not load plugin"- You deleted or moved the
.terraformdirectory inside cdktf.out
When NOT to use this
- The error names an unknown provider address (fix the provider source instead)
- Synth fails (fix synth first)
Root cause
CDKTF runs terraform init automatically during deploy, but the plugin cache inside cdktf.out can go stale (provider version changed, directory deleted, config regenerated with different requirements). Terraform then cannot find compatible plugin binaries and asks for reinitialization.
Edge cases
cdktf.outis regenerated on every synth; manualterraform initinside it is sometimes needed when CDKTF's automatic init is skipped.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.