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?
Best Answer
Setting
KUBE_CONFIG_PATH=~/.kube/config
forces terraform to read specific config, as per https://www.terraform.io/language/settings/backends/kubernetes#configuration-variablesIt's unclear, however, why this issue happened in a first place