cdktf deploy fails because synthesized JSON has the provider version but no source in required_providers
Diagnoses cdktf deploy failures where the generated cdk.tf.json lists a provider version (e.g. docker ~> 2.0) without a source, so Terraform cannot install it. Covers re-running cdktf get, pinning the provider source, and checking cdktf.json. Use when deploy fails on provider installation after a get/synth cycle. Not for registry network errors.
TL;DR
Re-run cdktf get and check the generated required_providers block in cdk.tf.json. The provider entry needs both source and version; if source is missing, regenerate bindings or pin the provider explicitly in your stack.
The error
cdktf deploy fails because the synthesized Terraform JSON has a provider entry like "docker": "~> 2.0" with no source, so Terraform cannot determine where to install the provider from. The valid form is:
"required_providers": {
"docker": { "source": "terraform-providers/docker" }
}Fix it
- Open
cdktf.out/stacks/[stack]/cdk.tf.jsonand inspectterraform.required_providers. - If a provider entry is missing
source, re-runcdktf getto regenerate the bindings; stale generations are the usual cause. - If the problem persists, set the provider source explicitly in your stack code or
cdktf.jsonprovider configuration. - Delete the stale
cdktf.outdirectory and re-runcdktf synth, thencdktf deploy.
Expected result: required_providers contains both source and version, and deploy installs the provider.
When to use this
cdktf deployfails at provider installation right aftercdktf get+cdktf synthcdk.tf.jsonshows a version-only provider entry
When NOT to use this
- Terraform fails to download a provider that has a correct source (network/registry issue)
- The error is "unknown provider" with a
registry.terraform.io/-/address (different bug, see the unknown-provider skill)
Root cause
Older CDKTF code generation emitted version-only provider requirements, which Terraform 0.13+ rejects because it needs an explicit source address to install from. Regenerating bindings with a current cdktf writes the full source + version block.
Edge cases
- Community providers that moved namespaces (e.g. docker from terraform-providers to kreuzwerker) need the source updated, not just regenerated.
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.