Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Failed to install provider when k8s resource is within a submodule #63

Closed
hadim opened this issue Nov 24, 2020 · 2 comments
Closed

Comments

@hadim
Copy link

hadim commented Nov 24, 2020

Using TF 0.13.5 and k8s 0.8.3.

When my k8s resource is within a submodule of the root module:

resource "k8s_manifest" "nvidia_installer" {
  content = data.template_file.nvidia_installer.rendered
}

and my root module declares the k8s provider:

provider "k8s" {
  host                   = "https://${module.cluster.endpoint}"
  token                  = data.google_client_config.default.access_token
  cluster_ca_certificate = base64decode(module.cluster.master_ca_certificate)
}

then upon tf init:

\Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Using previously-installed hashicorp/google-beta v3.49.0
- Using previously-installed hashicorp/template v2.2.0
- Using previously-installed hashicorp/google v3.49.0
- Using previously-installed banzaicloud/k8s v0.8.3
- Using previously-installed hashicorp/kubernetes v1.13.3
- Using previously-installed hashicorp/random v3.0.0
- Finding latest version of hashicorp/k8s...

Error: Failed to install provider

Error while installing hashicorp/k8s: provider registry registry.terraform.io
does not have a provider named registry.terraform.io/hashicorp/k8s

Looks like somehow tf is looking for hashicorp/k8s. When I move resource "k8s_manifest" "nvidia_installer" within the root module, everything is fine.

Is that a known issue or am I doing something wrong?

@hadim
Copy link
Author

hadim commented Nov 24, 2020

Looks like it's a TF related issue: hashicorp/terraform#26448

@hadim
Copy link
Author

hadim commented Nov 24, 2020

Using

terraform {
  required_version = ">= 0.13"

  required_providers {
    k8s = {
      source  = "banzaicloud/k8s"
      version = ">=0.8.3"
    }
  }
}

within the submodule works. (not ideal but working...)

@hadim hadim closed this as completed Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant