-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Backend kubernetes and terraform version 1.1.0 and above #31275
Comments
HI @kubovdm, Your comment suggests that you are using Terragrunt to complete the backend configuration, but the error suggest that is not being done correctly. There is no Thanks! |
Hi @jbardin, |
I don't see any changes in the Terraform backend for v1.1. It's possible that the supporting libraries made an update which affects the parsing of the configuration. Have you tried what the error suggests by setting |
Add KUBERNETES_MASTER with copy value from KUBE_HOST and have same error. Such feeling that env are ignored. |
I think backend ignore env and try to search .kube/config, but why... |
Find this in documentation: |
It looks like same bug: #31272 Data source values are not accessible during apply. |
I'm running into the same issue, attempting to set up the backend with a service account instead of kubeconfig. Neither attempting to rely on the respective env vars to be sourced, nor providing explicit values work, resulting in the "Failed to initialize kubernetes configuration: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable" error. terraform {
backend "kubernetes" {
secret_suffix = "foo"
host = "..."
token = "..."
insecure = true
}
} |
I was able to work around it using a dummy kubeconfig: # ./kubeconfig
kind: Config
apiVersion: v1
clusters:
- cluster:
server: https://localhost
name: dummy
contexts:
- context:
cluster: dummy
name: dummy
current-context: dummy
preferences: {}
users: [] terraform {
backend "kubernetes" {
config_path = "./kubeconfig"
}
} |
Thanks @carhartl , that worked for me too. |
On a related note, the docs say. For most use cases either in_cluster_config, config_path, or config_paths will need to be set. If all flags are set the configuration at config_path will be used. So I tried using |
I think this is due to a bug here, when the required config e.g.
Compare this with configure.go in the kubernetes provider, where the terraform/internal/backend/remote-state/kubernetes/backend.go Lines 228 to 267 in 2864351
|
Hi. I have container with terraform version 1.0.11 and setuped terraform backend kubernetes. I use ENV vars KUBE_HOST,KUBE_CLUSTER_CA_CERT_DATA,KUBE_TOKEN inside containers. If i try upgrade terraform version i have error
Error: Failed to initialize kubernetes configuration: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
Such a feeling backend ignore ENVs.
Terraform Version
Terraform Configuration Files
Debug Output
The text was updated successfully, but these errors were encountered: