<p>I'm trying to configure the kubernetes provider in Terraform, however I've been unable to do it so far. EKS uses heptio authenticator, so I don't have certificate paths I can provide to the Kubernetes provider. What is the right way to accomplish this?</p>

<p>I already tried something like this:</p>

<pre><code>provider "kubernetes" {
  config_context_auth_info = "context1"
  config_context_cluster   = "kubernetes"
}
</code></pre>

<p>Getting as a result:</p>

<pre><code>Error: Error applying plan:

1 error(s) occurred:

* kubernetes_namespace.example: 1 error(s) occurred:

* kubernetes_namespace.example: Post http://localhost/api/v1/namespaces: dial tcp [::1]:80: getsockopt: connection refused
</code></pre>

<p>I have a ~/.kube/config in place, what could I be missing?</p>

<p>Such behaviour could be caused by known core bug: <a href="https://github.com/hashicorp/terraform/issues/12393" rel="nofollow noreferrer">core: No interpolation for cross-provider dependencies #12393</a>. </p>

<p>There is an issue on the Terraform Github that describes a similar case with the same error - <a href="https://github.com/hashicorp/terraform/issues/12869#issuecomment-288339585" rel="nofollow noreferrer">#12869</a>.<br>
It is about issues related to GKE, but I guess it could affect EKS also.</p>

<p>Here is a <a href="https://gist.github.com/radeksimko/1a2cc98c5536bd4aa92e960ed7a47cf0" rel="nofollow noreferrer">link</a> to gist with an example of using kubernetes_provider.<br>
It also related to GKE, but I believe with slight changes it could be applied to EKS.</p>

<p>Consider also checking another good <a href="https://stackoverflow.com/a/50104891/9521610">answer</a> on StackOverflow related to your question.<br>
In brief, the solution is to create Kubernetes cluster on the first stage and then create Kubernetes objects on the second stage.</p>
