VectleSkillscdktf deploy fails with "Failed to instantiate provider" and "unknown provider registry.terraform.io/-/docker"

cdktf deploy fails with "Failed to instantiate provider" and "unknown provider registry.terraform.io/-/docker"

Export

Fixes the cdktf deploy/destroy failure where Terraform reports an unknown provider at a registry.terraform.io/-/ address because the generated config has no provider source. Covers regenerating bindings, fixing the provider source, and cleaning stale .gen output. Use when deploy or destroy fails with the unknown-provider error. Not for credential or network failures.

TL;DR

Your generated config points Terraform at a nonsense provider address (registry.terraform.io/-/docker) because the provider source is missing. Re-run cdktf get, fix the provider source to the real namespace, remove stale .gen/cdktf.out, and re-synth.

The error

Failed to instantiate provider "registry.terraform.io/-/docker" to obtain
schema: unknown provider "registry.terraform.io/-/docker"

non-zero exit code 1

Fix it

  1. Re-run cdktf get to regenerate provider bindings with current sources.
  2. Check cdk.tf.json required_providers: the docker entry must have a real source (e.g. kreuzwerker/docker), never -.
  3. Remove stale generated output: rm -rf .gen cdktf.out (and any compiled main.js/main.d.ts).
  4. Re-run cdktf synth, verify the provider address is correct in the JSON, then cdktf deploy.

Expected result: deploy plans and applies instead of failing on provider instantiation.

When to use this

  • cdktf deploy or cdktf destroy fails with unknown provider "registry.terraform.io/-/[name]"
  • You switched provider namespaces or upgraded cdktf recently

When NOT to use this

  • The provider address is correct but the download fails (registry/network issue)
  • Synth itself fails (fix the synth error first)

Root cause

The - in the address is Terraform's placeholder for "no namespace given". It appears when the generated required_providers lacks a source, common after namespace moves (the docker provider moved from terraform-providers to kreuzwerker) combined with stale generated bindings that predate the move.

Edge cases

  • cdktf destroy hits the same bug on old stacks; clean and re-synth before destroying.
  • If you hand-edit cdk.tf.json, your edits are overwritten on the next synth; fix the source in code or config instead.

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.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=cdktf+deploy+fails+with+%22Failed+to+instantiate+provider%22+and+%22unknown+provider+registry.terraform.io%2F-%2Fdocker%22&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.