Score:0

Failed to initialize kubernetes configuration when using terraform plan

pk flag

I've migrated my old terraform install from some 1.0 version (sadly, don't remember which exactly) to latest, installed with nix

terraform -v                                                                                                                      
Terraform v1.1.7
on linux_amd64

After issuing terraform plan i'm getting the following error:

Error: Failed to initialize kubernetes configuration: context "redacted-context" does not exist

My main.tf configured with k8s backend as following:

terraform {
  required_version = ">=0.13.0"
  backend "kubernetes" {
    secret_suffix    = "redacted-suffix"
    load_config_file = true
    config_context   = "redacted-context"
    namespace        = "redacted-namespace"
  }
}

Using strace -f terraform plan i don't see any attempts to read ~/.kube/config

How can i make terraform to read and use deafault kubeconfig?

Score:0
pk flag

Setting KUBE_CONFIG_PATH=~/.kube/config forces terraform to read specific config, as per https://www.terraform.io/language/settings/backends/kubernetes#configuration-variables

It's unclear, however, why this issue happened in a first place

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.