<p>Just looking for some clarification if possible..</p>
<p>If we look at the below <code>cluster.yaml</code> for eksctl;</p>
<pre><code>metadata:
  name: blah
  region: blah
  version: blah
managedNodeGroups:
  - name: blah
    instance_type: blah
    blah
    blah
    blah
    iam:
      withAddonPolicies:
        appMesh: true
        xray: true
</code></pre>
<p>I'm not using this to build the cluster, it's being built using Terraform.. but I'm looking for clarification as to how to apply the addon policies using TF? Is it simply using the <code>aws_eks_addon</code> resource?</p>
<p>So would it simply look like:</p>
<pre><code>resource &quot;aws_eks_addon&quot; &quot;xray&quot; {
  cluster_name = aws_eks_cluster.example.name
  addon_name   = &quot;xray&quot;
}
</code></pre>
<p>Am I barking up the right tree?</p>
<p>TIA</p>

jonnybinthemix
<p>The <code>nodeGroups.iam.withAddonPolicies</code> in the <code>eksctl</code> YAML files is about adding <a href="https://eksctl.io/usage/iam-policies/#iam-policies" rel="nofollow noreferrer">extra IAM policies to a specified node group</a>.</p>
<p>In your example in the question it's creating a <a href="https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html" rel="nofollow noreferrer">managed node group</a> with extra IAM policies allowing the nodes in the node group to use <a href="https://aws.amazon.com/app-mesh/" rel="nofollow noreferrer">AWS App Mesh</a> and <a href="https://aws.amazon.com/xray/" rel="nofollow noreferrer">X-Ray</a>.</p>
<p><a href="https://docs.aws.amazon.com/eks/latest/userguide/eks-add-ons.html" rel="nofollow noreferrer">Cluster add-ons</a>, on the other hand, add extra components to your cluster as a managed service. These would normally be deployed as a deployment via <code>kubectl</code> or <code>helm</code> etc and creates pods on your cluster to manage specific things. Currently this is limited to running CoreDNS, the VPC CNI plugin and <code>kube-proxy</code> so you wouldn't be able to apply your Terraform example as there is no <code>xray</code> cluster add-on.</p>
