-
Notifications
You must be signed in to change notification settings - Fork 55
provider seems to fall back to, rather than ignore, kubeconfig_path when kubeconfig_raw is set #90
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
Comments
The current implementation is, if |
Here's a few more details on my use case: I'm using terraform-aws-eks to create an EKS cluster. I then configure the data "aws_eks_cluster" "cluster" {
name = module.eks.cluster_id
}
data "aws_eks_cluster_auth" "cluster" {
name = module.eks.cluster_id
}
locals {
# non-default context name to protect from using wrong kubeconfig
kubeconfig_context = "_terraform-kustomization-${var.cluster_name}_"
kubeconfig = {
apiVersion = "v1"
clusters = [
{
name = local.kubeconfig_context
cluster = {
certificate-authority-data = data.aws_eks_cluster.cluster.certificate_authority.0.data
server = data.aws_eks_cluster.cluster.endpoint
}
}
]
users = [
{
name = local.kubeconfig_context
user = {
token = data.aws_eks_cluster_auth.cluster.token
}
}
]
contexts = [
{
name = local.kubeconfig_context
context = {
cluster = local.kubeconfig_context
user = local.kubeconfig_context
}
}
]
}
}
provider "kustomization" {
kubeconfig_raw = yamlencode(local.kubeconfig)
context = local.kubeconfig_context
} And I never want to use credentials from my local |
I had the same problem on GCP. Explicitly specifying the |
This commit changes the provider to require exactly one of `kubeconfig_path` or `kubeconfig_raw` set. The environment variable `KUBECONFIG_PATH` is available to set `kubeconfig_path`. Previously, the provider tried to find a valid configuration in either `kubeconfig_raw` or `kubeconfig_path` and would fall back to `kubectl` default environment variables and paths if no configuration was given.
This commit changes the provider to require exactly one of `kubeconfig_path` or `kubeconfig_raw` set. The environment variable `KUBECONFIG_PATH` is available to set `kubeconfig_path`. Previously, the provider tried to find a valid configuration in either `kubeconfig_raw` or `kubeconfig_path` and would fall back to `kubectl` default environment variables and paths if no configuration was given.
This commit changes the provider to require exactly one of `kubeconfig_path` or `kubeconfig_raw` set. The environment variable `KUBECONFIG_PATH` is available to set `kubeconfig_path`. Previously, the provider tried to find a valid configuration in either `kubeconfig_raw` or `kubeconfig_path` and would fall back to `kubectl` default environment variables and paths if no configuration was given.
This commit changes the provider to require exactly one of `kubeconfig_path` or `kubeconfig_raw` set. The environment variable `KUBECONFIG_PATH` is available to set `kubeconfig_path`. Previously, the provider tried to find a valid configuration in either `kubeconfig_raw` or `kubeconfig_path` and would fall back to `kubectl` default environment variables and paths if no configuration was given.
This commit changes the provider to require exactly one of `kubeconfig_path` or `kubeconfig_raw` set. The environment variable `KUBECONFIG_PATH` is available to set `kubeconfig_path`. Previously, the provider tried to find a valid configuration in either `kubeconfig_raw` or `kubeconfig_path` and would fall back to `kubectl` default environment variables and paths if no configuration was given.
Require one of `kubeconfig_path` or `kubeconfig_raw` fix #90
I would actually favor something like the helm provider does:
|
I'm using version 0.3.1.
I haven't investigated this completely, but I was setting
kubeconfig_raw
in the provider, which was invalid in some way (I believe), and it seemed like the plugin fell back to the default context in my local~/.kube/config
.This seems contrary to the docs, which state
And it's also potentially highly dangerous to use an unexpected kubeconfig.
terraform-provider-kustomization/kustomize/provider.go
Lines 83 to 95 in 2341cf8
I fixed my config, but would like:
The text was updated successfully, but these errors were encountered: