terraform-provider-kubectl icon indicating copy to clipboard operation
terraform-provider-kubectl copied to clipboard

Unable to get the right provider source. It's always pointing to registry.terraform.io/hashicorp/kubectl.

Open jpdoria opened this issue 2 years ago • 4 comments

Hi, I'd like to report this issue. I'm always getting this error in Terraform ~> v1.3.0, but it's working fine in v1.2.8.

Error: failed to read schema for module.eks.kubectl_manifest.istio_knative in registry.terraform.io/hashicorp/kubectl: failed to instantiate provider "registry.terraform.io/hashicorp/kubectl" to obtain schema: unavailable provider "registry.terraform.io/hashicorp/kubectl"

I'm using this in all my versions.tf files within the project.

terraform {
  required_version = "~> 1.3.0"
  required_providers {
    kubectl = {
      source  = "gavinbunney/kubectl"
      version = "~> 1.14.0"
    }
  }
}

Even tried running the command below but to no avail.

terraform state replace-provider "registry.terraform.io/hashicorp/kubectl" "registry.terraform.io/gavinbunney/kubectl"

jpdoria avatar Oct 21 '22 15:10 jpdoria

Very weird. Witnessed similar behavior today while upgrading / refactoring a module using gavinbunney/kubectl.

Error: failed to read schema for module.layer_2.module.eks_lb_ctrl.kubectl_manifest.crds in registry.terraform.io/hashicorp/kubectl: failed to instantiate provider "registry.terraform.io/hashicorp/kubectl" to obtain schema: unavailable provider "registry.terraform.io/hashicorp/kubectl"

After reverting a temporarily commented out resource things started working again.

trallnag avatar Nov 01 '22 17:11 trallnag

Was running into this as well. Need to explicitly declare the provider in each module...

jonathonbattista avatar Nov 09 '22 19:11 jonathonbattista

I have the same issue....

│ Error: Failed to query available provider packages │ │ Could not retrieve the list of available versions for provider hashicorp/kubectl: provider registry registry.terraform.io does not have a provider named │ registry.terraform.io/hashicorp/kubectl │ │ Did you intend to use gavinbunney/kubectl? If so, you must specify that source address in each module which requires that provider. To see which modules are currently │ depending on hashicorp/kubectl, run the following command: │ terraform providers ╵

ankitcharolia avatar Dec 20 '22 15:12 ankitcharolia

Was running into this as well. Need to explicitly declare the provider in each module...

Yes, I got it working by repeating the declaration in the root of the terraform dir and in the module that is actuating using this provider.

yc2984 avatar Feb 01 '24 15:02 yc2984