title: Cannot communicate with my Kubernetes Cluster using Terraform
body: <p>I was trying to get started with AWS EKS Kubernetes cluster provisioning using Terraform. I was following the tutorial and got stuck on the moment with the kubeconfig file.
  After the command: <code>terraform output kubeconfig &gt; ~/.kube/config</code>, I should be able to communicate with the cluster. Unfortunately, when I try to use any command together with <code>kubectl</code>, for example cluster-info, I get an error <strong>error loading config file, yaml: line 4: mapping values are not allowed in this context</strong></p>
  <p>This is the code of the outputs.tf file:</p>
  <pre><code># Outputs
  #
  
  locals {
    config_map_aws_auth = &lt;&lt;CONFIGMAPAWSAUTH
  
  
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: aws-auth
    namespace: kube-system
  data:
    mapRoles: |
      - rolearn: ${aws_iam_role.demo-node.arn}
        username: system:node:{{EC2PrivateDNSName}}
        groups:
          - system:bootstrappers
          - system:nodes
  CONFIGMAPAWSAUTH
  
    kubeconfig = &lt;&lt;KUBECONFIG
  
  
  apiVersion: v1
  clusters:
  - cluster:
      server: ${aws_eks_cluster.demo.endpoint}
      certificate-authority-data: ${aws_eks_cluster.demo.certificate_authority[0].data}
    name: kubernetes
  contexts:
  - context:
      cluster: kubernetes
      user: aws
    name: aws
  current-context: aws
  kind: Config
  preferences: {}
  users:
  - name: aws
    user:
      exec:
        apiVersion: client.authentication.k8s.io/v1beta1
        command: aws-iam-authenticator
        args:
          - &quot;token&quot;
          - &quot;-i&quot;
          - &quot;${var.cluster-name}&quot;
  KUBECONFIG
  }
  
  output &quot;config_map_aws_auth&quot; {
    value = local.config_map_aws_auth
  }
  
  output &quot;kubeconfig&quot; {
    value = local.kubeconfig
  }```
  
    
  </code></pre>