<p>I'm trying to deploy a cluster with self managed node groups. No matter what config options I use, I always come up with the following error:</p>
<p><strong>Error: Post &quot;</strong><a href="http://localhost/api/v1/namespaces/kube-system/configmaps" rel="noreferrer"><strong>http://localhost/api/v1/namespaces/kube-system/configmaps</strong></a><strong>&quot;: dial tcp 127.0.0.1:80: connect: connection refusedwith module.eks-ssp.kubernetes_config_map.aws_auth[0]on .terraform/modules/eks-ssp/aws-auth-configmap.tf line 19, in resource &quot;kubernetes_config_map&quot; &quot;aws_auth&quot;:resource &quot;kubernetes_config_map&quot; &quot;aws_auth&quot; {</strong></p>
<p>​</p>
<p>The .tf file looks like this:</p>
<pre><code>module &quot;eks-ssp&quot; {
source = &quot;github.com/aws-samples/aws-eks-accelerator-for-terraform&quot;

# EKS CLUSTER
tenant            = &quot;DevOpsLabs2&quot;
environment       = &quot;dev-test&quot;
zone              = &quot;&quot;
terraform_version = &quot;Terraform v1.1.4&quot;

# EKS Cluster VPC and Subnet mandatory config
vpc_id             = &quot;xxx&quot;
private_subnet_ids = [&quot;xxx&quot;,&quot;xxx&quot;, &quot;xxx&quot;, &quot;xxx&quot;]

# EKS CONTROL PLANE VARIABLES
create_eks         = true
kubernetes_version = &quot;1.19&quot;

# EKS SELF MANAGED NODE GROUPS
self_managed_node_groups = {
self_mg = {
node_group_name        = &quot;DevOpsLabs2&quot;
subnet_ids             = [&quot;xxx&quot;,&quot;xxx&quot;, &quot;xxx&quot;, &quot;xxx&quot;]
create_launch_template = true
launch_template_os     = &quot;bottlerocket&quot;       # amazonlinux2eks  or bottlerocket or windows
custom_ami_id          = &quot;xxx&quot;
public_ip              = true                   # Enable only for public subnets
pre_userdata           = &lt;&lt;-EOT
yum install -y amazon-ssm-agent \
systemctl enable amazon-ssm-agent &amp;&amp; systemctl start amazon-ssm-agent \
EOT

disk_size     = 20
instance_type = &quot;t2.small&quot;
desired_size  = 2
max_size      = 10
min_size      = 2
capacity_type = &quot;&quot; # Optional Use this only for SPOT capacity as  capacity_type = &quot;spot&quot;

k8s_labels = {
Environment = &quot;dev-test&quot;
Zone        = &quot;&quot;
WorkerType  = &quot;SELF_MANAGED_ON_DEMAND&quot;
}

additional_tags = {
ExtraTag    = &quot;t2x-on-demand&quot;
Name        = &quot;t2x-on-demand&quot;
subnet_type = &quot;public&quot;
}
create_worker_security_group = false # Creates a dedicated sec group for this Node Group
},
}
}

module &quot;eks-ssp-kubernetes-addons&quot; {
source = &quot;github.com/aws-samples/aws-eks-accelerator-for-terraform//modules/kubernetes-addons&quot;

eks_cluster_id                        = module.eks-ssp.eks_cluster_id

# EKS Addons
enable_amazon_eks_vpc_cni             = true
enable_amazon_eks_coredns             = true
enable_amazon_eks_kube_proxy          = true
enable_amazon_eks_aws_ebs_csi_driver  = true

#K8s Add-ons
enable_aws_load_balancer_controller   = true
enable_metrics_server                 = true
enable_cluster_autoscaler             = true
enable_aws_for_fluentbit              = true
enable_argocd                         = true
enable_ingress_nginx                  = true

depends_on = [module.eks-ssp.self_managed_node_groups]
}
</code></pre>
<p>Providers:</p>
<pre><code>terraform {

  backend &quot;remote&quot; {}

  required_providers {
    aws = {
      source  = &quot;hashicorp/aws&quot;
      version = &quot;&gt;= 3.66.0&quot;
    }
    kubernetes = {
      source  = &quot;hashicorp/kubernetes&quot;
      version = &quot;&gt;= 2.6.1&quot;
    }
    helm = {
      source  = &quot;hashicorp/helm&quot;
      version = &quot;&gt;= 2.4.1&quot;
    }
  }
}
</code></pre>

<p>Based on the example provided in the Github repo [1], my guess is that the <code>provider</code> configuration blocks are missing for this to work as expected. Looking at the code provided in the question, it seems that the following needs to be added:</p>
<pre><code>data &quot;aws_region&quot; &quot;current&quot; {}

data &quot;aws_eks_cluster&quot; &quot;cluster&quot; {
  name = module.eks-ssp.eks_cluster_id
}

data &quot;aws_eks_cluster_auth&quot; &quot;cluster&quot; {
  name = module.eks-ssp.eks_cluster_id
}

provider &quot;aws&quot; {
  region = data.aws_region.current.id
  alias  = &quot;default&quot; # this should match the named profile you used if at all
}

provider &quot;kubernetes&quot; {
  experiments {
    manifest_resource = true
  }
  host                   = data.aws_eks_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  token                  = data.aws_eks_cluster_auth.cluster.token
}
</code></pre>
<p>If <code>helm</code> is also required, I think the following block [2] needs to be added as well:</p>
<pre><code>provider &quot;helm&quot; {
  kubernetes {
    host                   = data.aws_eks_cluster.cluster.endpoint
    token                  = data.aws_eks_cluster_auth.cluster.token
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  }
}
</code></pre>
<p>Provider argument reference for <code>kubernetes</code> and <code>helm</code> is in [3] and [4] respectively.</p>
<hr />
<p>[1] <a href="https://github.com/aws-samples/aws-eks-accelerator-for-terraform/blob/main/examples/eks-cluster-with-self-managed-node-groups/main.tf#L23-L47" rel="noreferrer">https://github.com/aws-samples/aws-eks-accelerator-for-terraform/blob/main/examples/eks-cluster-with-self-managed-node-groups/main.tf#L23-L47</a></p>
<p>[2] <a href="https://github.com/aws-samples/aws-eks-accelerator-for-terraform/blob/main/examples/eks-cluster-with-eks-addons/main.tf#L49-L55" rel="noreferrer">https://github.com/aws-samples/aws-eks-accelerator-for-terraform/blob/main/examples/eks-cluster-with-eks-addons/main.tf#L49-L55</a></p>
<p>[3] <a href="https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs#argument-reference" rel="noreferrer">https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs#argument-reference</a></p>
<p>[4] <a href="https://registry.terraform.io/providers/hashicorp/helm/latest/docs#argument-reference" rel="noreferrer">https://registry.terraform.io/providers/hashicorp/helm/latest/docs#argument-reference</a></p>
