-
Notifications
You must be signed in to change notification settings - Fork 983
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
If ~/.kube/config specifies insecure-skip-tls-verify: true, Kubernetes provider cannot override it #189
Comments
Had a similar problem with the helm provider. I seem to be having success with the following workaround: add
In my case the only context in my config is |
Interestingly @jamesrcounts solution only seems to work in a helm provider, adding it to the main kubernetes provider throws an error for us:
Latest version of both providers. |
@adamdodev the current kubernetes provider (1.8.0) has an argument From the docs
This worked for me with the same issues you have. I haven't checked since which version this is available however. |
As per @blandir's comment, |
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 👉 hashibot-feedback@hashicorp.com. Thanks! |
Summary
It appears that if your
~/.kube/config
specifies a cluster withinsecure-skip-tls-verify: true
, then it is not possible to use Terraform to manage a different Kubernetes cluster and also validate the TLS certificate. Settinginsecure = false
does not appear to override the setting from~/.kube/config
.There's an obvious workaround (update your
~/.kube/config
file,) but it's not initially obvious that the problem is caused by the Kubernetes provider being unable to override the setting in your~/.kube/config
file.Terraform Version
Affected Resource(s)
kubernetes
providerTerraform Configuration Files
kubeconfig
My
~/.kube/config
has a single cluster, and it hasinsecure-skip-tls-verify
set totrue
. This is not the cluster I am using Terraform to manage; it just happens to be in my configuration.Debug Output
https://gist.github.com/RobinsonWM/8f927ee586ba51c89809ebcd782fcbdc
Expected Behavior
It should have authenticated to my k8s cluster and created a namespace.
Actual Behavior
It gave an error message and stopped before authenticating to k8s. This error is coming from the Kubernetes client Go library because Terraform passed a Cluster CA certificate, but it also passed the
Insecure
flag to request that the certificate not be validated:Steps to Reproduce
~/.kube/config
to look like the one above - specifically, a single cluster that hasinsecure-skip-tls-verify: true
cluster_ca_certificate
and withinsecure
set tofalse
terraform plan
orterraform apply
Important Factoids
We have reproduced this on Windows 10 and Mac OS X.
References
I think this might be very similar to an issue that was fixed in the Datadog provider: hashicorp/terraform#12168
The text was updated successfully, but these errors were encountered: