title: How to create a k8s configmap by looping over nested helm values
body: <p>The helm values look like in the following example. Here <code>appdata</code> can scale to any number but will contain the same set of keys.</p>
  <pre><code>data:
    appdata:
      config0:
        url: 'https://example1.com'
        port: '80'
      config1:
        url: 'https://example2.com'
        port: '8673'
      someotherconfig:
        url: 'https://example3.com'
        port: '9887'
      ...
      ...
  </code></pre>
  <p>This is what I have so far. This keeps updating the last config's data from <code>someotherconfig</code> key and also I want to have the config map name to contain the config name for each iteration, like {{ template &quot;app&quot; $ }}-config0, {{ template &quot;app&quot; $ }}-config1 and so on based on iteration.</p>
  <pre><code>{{- range $Mydata := $.Values.data.appdata }}
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: {{ template &quot;app&quot; $ }}
    labels:
  data:
    url: {{ $Mydata.url }}
    port: {{ $Mydata.port }}
  {{- end }}
  </code></pre>