<p>I have the following <code>configmap-app.yaml</code> file:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Chart.Name }}
  labels:
    {{- include &quot;app.labels&quot; . | nindent 4 }}
data:
  application.yaml: {{ (tpl (.Files.Get &quot;files/application.yaml&quot;) . | quote ) }}
</code></pre>
<p>For <code>application.yaml</code> I need to add one config file or the other, based on a boolean flag:</p>
<pre><code>{{ if .Values.validation.enabled }}
    # use first configmap
{{ else }}
    # use second configmap
{{ end }}
</code></pre>
<p>If validation.enabled=true then <code>application.yaml</code> should read from <code>files/application-first.yaml</code> and if validation.enabled=false, then it should read from <code>files/application-second.yaml</code>. How can I accomplish that?</p>

cybertextron
<p>Your example/assumption seems correct, you just need to specify <code>second</code> file in the else section.</p>
<pre><code>{{ if .Values.validation.enabled }}
    application.yaml: {{ (tpl (.Files.Get &quot;files/application.yaml&quot;) . | quote ) }}
{{ else }}
    application.yaml: {{ (tpl (.Files.Get &quot;files/application-second.yaml&quot;) . | quote ) }}
{{ end }}
</code></pre>
<p>Make sure to add a variable in the value file</p>
<pre><code>validation:
  enabled: true
</code></pre>
