<p>My Config Map Template</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Values.configmap.name }}
binaryData:
  {{- range .Values.configmap.binaryData }}
  {{ .key }}: {{ .value }}
  {{- end }}
</code></pre>
<p>My <code>values.yaml</code> that sets configmap looks like this</p>
<pre><code>...
configmap:
    name: foo
    binaryData:
    - key: file1
      value: something_as_base64
    - key: file2
      value: something_as_base64
    - key: file3
      value: something_as_base64
...
</code></pre>
<p><strong>What works: I can set ALL the array items</strong></p>
<pre><code>helm upgrade foo_name bar_dir \
--set configmap.binaryData[0].key=file1 --set configmap.binaryData[0].value=xyz \
--set configmap.binaryData[1].key=file2 --set configmap.binaryData[1].value=xyz \
--set configmap.binaryData[N].key=file2 --set configmap.binaryData[N].value=xyz
</code></pre>
<p><strong>What does NOT works: Update value of file2 (array[N]), just one item</strong></p>
<pre><code>helm upgrade foo_name bar_dir \
--set configmap.binaryData[1].key=file2 --set configmap.binaryData[1].value=xyz \
</code></pre>
<p>Error</p>
<pre><code>Error: UPGRADE FAILED: template: foo-helm/templates/configmap.yaml:x:y: executing &quot;foo-helm/templates/configmap.yaml&quot; at &lt;.key&gt;: nil pointer evaluating interface {}.key
</code></pre>
<ul>
<li>Is there any syntax to specifically update Nth item of an array?</li>
<li>Also if my values.yaml has 5 items in array, and I set array[0], then [1-4] are getting truncated off</li>
</ul>

Srinath Ganesh
<p>From this helm <a href="https://github.com/helm/helm/issues/8320" rel="nofollow noreferrer">issue</a> it seems it's not possible. The workaround is to use map instead or have seprate files with different arrays, please see the <a href="https://github.com/helm/helm/issues/8320#issuecomment-644875049" rel="nofollow noreferrer">comment</a>.</p>
