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

[Bug]: Error: Invalid provider configuration #1083

Closed
zypriafl opened this issue Nov 7, 2023 · 8 comments
Closed

[Bug]: Error: Invalid provider configuration #1083

zypriafl opened this issue Nov 7, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@zypriafl
Copy link

zypriafl commented Nov 7, 2023

Description

The command "terraform apply -auto-approve" fails with:

Plan: 7 to add, 4 to change, 0 to destroy.

│ Error: Invalid provider configuration

│ Provider "registry.terraform.io/integrations/github" requires explicit configuration. Add a provider block to the root module and configure the provider's required arguments as described in the provider
│ documentation.



│ Error: GET https://api.github.com/user: 401 Requires authentication []

│ with provider["registry.terraform.io/integrations/github"],
│ on line 0:
│ (source code not available)

Any idea what I am missing here? Thanks for your help.

Kube.tf file

locals {
  # First and foremost set your Hetzner API token here. It can be found in your Project > Security > API Token (Read & Write is required).
  hcloud_token = "******"
}

module "kube-hetzner" {
  providers = {
    hcloud = hcloud
  }
  version = "v2.6.1"
  hcloud_token = local.hcloud_token
  source = "kube-hetzner/kube-hetzner/hcloud"
  ssh_public_key = file("~/.ssh/development_id_ed25519.pub")
  ssh_private_key = file("~/.ssh/development_id_ed25519")
  network_region = "eu-central"
  control_plane_nodepools = [
    {
      name        = "control-plane-fsn1-cpx11",
      server_type = "cpx11",
      location    = "fsn1",
      labels      = [],
      taints      = [],
      count       = 1
    },
    {
      name        = "control-plane-nbg1-cpx11",
      server_type = "cpx11",
      location    = "nbg1",
      labels      = [],
      taints      = [],
      count       = 0
    },
    {
      name        = "control-plane-hel1-cpx11",
      server_type = "cpx11",
      location    = "hel1",
      labels      = [],
      taints      = [],
      count       = 0
    }
  ]
  agent_nodepools = [
    {
      name        = "agent-cpx11",
      server_type = "cpx11",
      location    = "fsn1",
      labels      = [],
      taints      = [],
      count       = 0
    },
    {
      name        = "agent-cpx31",
      server_type = "cpx31",
      location    = "fsn1",
      labels      = [],
      taints      = [],
      count       = 1
    },
    {
      name        = "agent-cx41",
      server_type = "cx41",
      location    = "fsn1",
      labels      = [],
      taints      = [],
      count       = 1
    },    
    {
      name        = "agent-very-cx51",
      server_type = "cx51",
      location    = "fsn1",
      labels      = [],
      taints      = [],
      count       = 0
    },    
  ]
  extra_firewall_rules = [
    {
      description     = "For outgoing."
      direction       = "out"
      protocol        = "tcp"
      port            = "any"
      source_ips      = []
      destination_ips = ["0.0.0.0/0", "::/0"]
    }
  ]  
  load_balancer_type     = "lb11"
  load_balancer_location = "fsn1"
  base_domain = "**************"
  automatically_upgrade_k3s = false
  automatically_upgrade_os = false
  ingress_controller = "nginx"
  cluster_name = "dev"
  lb_hostname = "**************"
  autoscaler_nodepools = [
    {
      name        = "autoscaler"
      server_type = "cx41"
      location    = "fsn1"
      min_nodes   = 0
      max_nodes   = 7
    }
  ]  
}
provider "hcloud" {
  token = local.hcloud_token
}

terraform {
  required_version = ">= 1.5.0"
  required_providers {
    hcloud = {
      source  = "hetznercloud/hcloud"
      version = ">= 1.44.1"
    }
  }
}

output "kubeconfig" {
  value     = module.kube-hetzner.kubeconfig
  sensitive = true
}

Screenshots

No response

Platform

Linux

@zypriafl zypriafl added the bug Something isn't working label Nov 7, 2023
@schlichtanders
Copy link
Contributor

I am also running into this - it is even independent of the version I am trying. (the old version which worked before, does no longer work)

I would guess kube-hetzner has a kind-of hidden dependency which is not fixed (I fixed all versions I could find in the kube.tf). terraform integrations/github

@schlichtanders
Copy link
Contributor

Looking through the source code I found that no terraform integration has a pinned version

source = "integrations/github"

I also cannot find any way to pin them

@schlichtanders
Copy link
Contributor

I created an upstream issue. Let's hope this gets clarified soon, as it seems to block all kube-hetzner deployments.
integrations/terraform-provider-github#2008

@schlichtanders
Copy link
Contributor

I also found a workaround. You need to adapt your kube.tf file to let the terraform section include a requirement for github with a version upper bound

terraform {
  required_version = ">= 1.3.3"
  required_providers {
    hcloud = {
      source  = "hetznercloud/hcloud"
      version = ">= 1.38.2"
    }
    github = {
      source  = "integrations/github"
      version = ">= 5.38.0, < 5.41.0"
    }
  }
}

@mysticaltech
Copy link
Collaborator

Thanks @schlichtanders I will publish your fix for now.

@mysticaltech
Copy link
Collaborator

@zypriafl This is fixed in v2.9.3, thanks for reporting it. @schlichtanders Appreciate the tip and you submitting the issue upstream. Will unbound when it is fixed.

@David-Crty
Copy link

I'm having this same issue with the latest version

@mysticaltech
Copy link
Collaborator

@David-Crty Make sure to run terraform init -upgrade and let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants