Terraform-provider-kubernetes: Alternative to load_config_file = false?

Created on 10 Feb 2021  ·  5Comments  ·  Source: hashicorp/terraform-provider-kubernetes

Terraform version, Kubernetes provider version and Kubernetes version

Terraform version: v0.13.5
Kubernetes Provider version: v2.0.2
Kubernetes version: v1.19.3

Terraform configuration

provider "kubernetes" {
    version                = "~> 2.0"
    host                   = var.ClusterEndpoint
    cluster_ca_certificate = try(base64decode(var.ClusterCertData), "")
    token                  = data.aws_eks_cluster_auth.cluster.token
    load_config_file       = false
}

Error

Error: Kubernetes cluster unreachable: stat /home/cra/.kube/config: no such file or directory

Question

Before upgrading the Kubernetes provider to v2.0.2, we used v1.13.3. In the earlier version we used load_config_file = false because we provide the credentials directly, as shown above, and don't want it to try load a non-existent file. But in the later version this is deprecated.
How do we replicate the behaviour now, and can that please be added to the documentation because there is little information on this?

question

All 5 comments

In this documentation it explains why it's been removed and by removing the load_config_file attribute the expected result is what we want but this isn't working.
I do not have KUBE_CONFIG_PATH, or config_path set.

Hi, recently @dak1n1 contributed some examples of how to work with each major cloud with examples - I think that the EKS example from that list may help you - https://github.com/hashicorp/terraform-provider-kubernetes/pull/1115. Let us know if those aren't sufficient.

I've also got a change in the works that will basically give us the same functionality as load_config_file = false. The goal is to create a more intuitive workflow by throwing an error when two mutually-exclusive configuration options are used (for example, if you've added a provider {} block containing a token, it will use that token instead of pulling the configuration options from an environment variable that you might not even know is set). https://github.com/hashicorp/terraform-provider-kubernetes/pull/1141

I have fixed the issue. The problem was that the Helm provider also had to be upgraded to "~> 2.0".

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings