<p>I just started working with ArgoCD and I have an issue I can't find the answer for.</p>
<p>I have a file called <code>clusters.yaml</code> in my Git repo:</p>
<pre><code>clusters:
- name: cluster1-eu-k8s-002
  url: https://cluster1.hcp.northeurope.azmk8s.io:443
  values: 
    nameOverride: ReplaceWithThis
</code></pre>
<p>And I am using the following ApplicationSet in order to deploy Opentelemetry-collector on a bunch of clusters grouped under the label <code>group:dev</code>.</p>
<pre><code>apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: opentelemetry-applicationset
  namespace: argocd
spec:
  generators:
  - git:
      repoURL: git@github.com:removed/cloud.git
      revision: HEAD
      files:
      - path: GitOps/argocd-apps/clusters.yaml
  - clusters:
      selector:
        matchLabels:
          argocd.argoproj.io/secret-type: cluster
          group: dev
  template:
    metadata:
      name: 'opentelemetry-{{name}}'
    spec:
      project: default
      sources:
      - repoURL: https://open-telemetry.github.io/opentelemetry-helm-charts
        chart: opentelemetry-collector
        targetRevision: 0.51.3
        helm:
          valueFiles: 
            - $values/GitOps/argocd-apps/opentelemetry-collector/values/values-dev.yaml
          parameters:
            - name: nameOverride
              value: '{{ index .Clusters.values &quot;nameOverride&quot; }}'
      - repoURL: git@github.com:removed/cloud.git
        ref: values
      destination:
        server: '{{ server }}'
        namespace: opentelemetry
</code></pre>
<p>I am trying to replace a parameter called <code>nameOverride</code> with my value <code>ReplaceWithThis</code> from <code>clusters.yaml</code>.</p>
<p>ArgoCD is not deploying my app because of this line: <code>value: '{{ index .Clusters.values &quot;nameOverride&quot; }}'</code></p>
<p>ArgoCD ApplicationSet controller logs throw some nonsense errors. I am sure I identified the problem correctly, because it works as expected if I just hardcore the string.</p>
<p>What exactly is the issue with the way I am trying to pull that value?</p>

Bogdan993
<p>The issue you're encountering is related to the way you're accessing the <code>nameOverride</code> value from <code>clusters.yaml</code> in the <code>value</code> field of your ArgoCD ApplicationSet.</p>
<p>In your current configuration, you're using the following expression to access the value:</p>
<pre><code>value: '{{ index .Clusters.values &quot;nameOverride&quot; }}'
</code></pre>
<p>However, the problem lies in the fact that the <code>values</code> field is defined at the top level of the <code>clusters.yaml</code> file, not nested under each cluster. Therefore, the correct path to access the value would be:</p>
<pre><code>value: '{{ index .ApplicationSetParameters.values &quot;nameOverride&quot; }}'
</code></pre>
<p>By modifying the expression as shown above, you should be able to access the <code>nameOverride</code> value correctly from <code>clusters.yaml</code> and deploy your application successfully.</p>
