Interview Prep/Terraform/Dependencies, Cycles and Providers

`provider registry registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/kubectl`.

BeginnerTroubleshootingDependencies, Cycles and Providers
Answer

Likely causes → A non-HashiCorp provider is used without a source in required_providers, so Terraform assumes hashicorp/<name>. Often happens in a child module that forgot to declare it.

Diagnose → The error says Did you intend to use ...? and names the module requiring it.

Fix → In every module that uses it:

terraform {
  required_providers {
    kubectl = {
      source  = "alekc/kubectl"
      version = "~> 2.0"
    }
  }
}

Prevent → Every module declares all its providers with source; tflint catches missing ones.

All Terraform questions Roadmap: Terraform

More on Dependencies, Cycles and Providers