<p>Given the following values.yaml</p>
<pre><code>elements:
  first:
    enabled: true
    url: first.url
  second:
    enabled: flase
    url: second.url
  third:
    enabled: true
    url: third.url
</code></pre>
<p>What would be a good way to obtain the following result:</p>
<pre><code>list_of_elements=first,third
</code></pre>
<p>Where the resulting list needs to contain only the elements that have been enabled. The list needs to be a single line of comma separated items.</p>

<p>A little bit lengthy but does its job:</p>
<pre><code>{{ $result := list }}
{{ range $k, $v := .Values.elements }}
{{ if eq (toString $v.enabled) &quot;true&quot; }}
{{ $result = append $result $k }}
{{ end }}
{{ end }}
list_of_elements: {{ join &quot;,&quot; $result }}
</code></pre>
