gavinbunney / terraform-provider-kubectl

Terraform provider to handle raw kubernetes manifest yaml files
https://registry.terraform.io/providers/gavinbunney/kubectl
Mozilla Public License 2.0
612 stars 105 forks source link

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

Open jpdoria opened 1 year ago

jpdoria commented 1 year ago

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"
trallnag commented 1 year ago

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.

jonathonbattista commented 1 year ago

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

ankitcharolia commented 1 year ago

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 ╵

yc2984 commented 7 months ago

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.