banzaicloud/terraform-provider-k8s

Provider crash due to apiVersion field in kubeconfig

Dudesons opened this issue · 3 comments

Describe the bug

I'm using a this tool https://github.com/imjasonh/gke-auth for managing kubeconfig with gke, it works great with the terraform provider but when I'm trying to apply something with the k8s provider I have the following error:

╷
│ Error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1"
│ 
│   with provider["registry.terraform.io/banzaicloud/k8s"],
│   on common.tf line 9, in provider "k8s":
│    9: provider "k8s" {
│ 
╵
ERRO[0009] 1 error occurred:
        * exit status 1

in my config I grep api:

grep api .kube/config 
apiVersion: v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1
      apiVersion: client.authentication.k8s.io/v1

and it seems this tools add this field and without this one it can't work

I tried to backport the config in the provider like that:

provider "k8s" {
  exec {
    api_version = "client.authentication.k8s.io/vbe1"
    args = [
      "--get"
    ]
    command = "gke-auth"
  }
}

it doesn't change anything

Steps to reproduce the issue:

create a gke cluster
install this tool https://github.com/imjasonh/gke-auth
generate the config:

gke-auth --project=[MY_PROJECT] \
    --location=[REGION_OR_ZONE] \
    --cluster=[CLUSTER_NAME]

Expected behavior

the provider doesn't crash due to the apiVersion field in the kube config

Screenshots

Additional context

Thank you @sagikazarmark for the review of #91
Just to know when do you think we new release will be available ?

I added a few more Kubernetes versions to the test matrix. Once those tests pass I'll tag a new version.

Hi @sagikazarmark, do you have an idea when the provider will be rebuilt in order to fix this issue ?