<p>I have been using following snippet to manage kubernetes auto scaling with terraform</p>
<pre><code>resource &quot;helm_release&quot; &quot;cluster-autoscaler&quot; {
  depends_on = [
    module.eks
  ]

  name             = &quot;cluster-autoscaler&quot;
  namespace        = local.k8s_service_account_namespace
  repository       = &quot;https://kubernetes.github.io/autoscaler&quot;
  chart            = &quot;cluster-autoscaler&quot;
  version          = &quot;9.10.7&quot;
  create_namespace = false
</code></pre>
<p>While all of this has been in working state for months (Gitlab CI/CD), it has suddenly stopped working and throwing following error.</p>
<pre><code>module.review_vpc.helm_release.cluster-autoscaler: Refreshing state... [id=cluster-autoscaler]
╷
│ Error: Kubernetes cluster unreachable: exec plugin: invalid apiVersion &quot;client.authentication.k8s.io/v1alpha1&quot;
│
│   with module.review_vpc.helm_release.cluster-autoscaler,
│   on ..\..\modules\aws\eks.tf line 319, in resource &quot;helm_release&quot; &quot;cluster-autoscaler&quot;:
│  319: resource &quot;helm_release&quot; &quot;cluster-autoscaler&quot; {
</code></pre>
<p>I am using AWS EKS with kubernetes version 1.21.</p>
<p>The terraform providers are as follows</p>
<pre><code>terraform {
  required_providers {
    aws = {
      source  = &quot;hashicorp/aws&quot;
      version = &quot;~&gt; 3.0&quot;
    }
    kubectl = {
      source  = &quot;gavinbunney/kubectl&quot;
      version = &quot;1.14.0&quot;
    }
  }
</code></pre>
<p><strong>UPDATE 1</strong></p>
<p>Here is the module for eks</p>
<pre><code>module &quot;eks&quot; {
  source                       = &quot;terraform-aws-modules/eks/aws&quot;
  version                      = &quot;17.24.0&quot;
</code></pre>

CuriousMind
<p>I had to do couple of changes to terraform scripts (not sure whey they were not required earlier).</p>
<ul>
<li><p>Added helm to required_providers section</p>
<p>helm = {
source  = &quot;hashicorp/helm&quot;
version = &quot;2.3.0&quot;
}</p>
</li>
<li><p>Replaced token generation from</p>
<p>exec {
api_version = &quot;client.authentication.k8s.io/v1alpha1&quot;
args        = [&quot;eks&quot;, &quot;get-token&quot;, &quot;--cluster-name&quot;, var.eks_cluster_name]
command     = &quot;aws&quot;
}</p>
</li>
</ul>
<p>to</p>
<pre><code>token = data.aws_eks_cluster_auth.cluster.token
</code></pre>
<p>Note that I am using <code>hashicorp/terraform:1.0.11</code> image on Gitlab runner to execute Terraform Code. Hence manually installing kubectl or aws CLI is not applicable in my case.</p>
