<p>I'm setting up a ConfigMap for my Helm chart.</p>

<p>As per good practice, I want to include non-yaml resources through separate files rather than inline. Currently I am trying to include both an xml file and a tpl helper in my ConfigMap under "data". Both are read without issue in the below code. But I cannot seem to make the indentation for the keys work properly.</p>

<p>My ConfigMap:</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
    name: {{ template "name" . }}
    labels:
        app: {{ template "name" . }}
        chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
        release: {{ quote .Release.Name }}
        heritage: {{ quote .Release.Service }}
        name: {{ template "name" . }}
data:
    logback.xml: |-
        {{- .Files.Get "application-resources/logback.xml" | nindent 8 -}}
    application.yml: |-
        {{- include "application.yml" . | nindent 8 -}}
</code></pre>

<p>This produces the following indentation (actual values are removed for readability):</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
    name: erklaering-anden-lov-detektor-app
    labels:
        app: name-of-app
        chart: name-of-chart
        release: "release-name"
        heritage: "Tiller"
        name: name-of-app
data:
    logback.xml: |-
      &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;configuration scan="true"&gt;
          &lt;xml-stuff&gt;
      &lt;/configuration&gt;
      application.yml: |-    
      application.yml.contents
</code></pre>

<p>Which should be:</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
    name: erklaering-anden-lov-detektor-app
    labels:
        app: name-of-app
        chart: name-of-chart
        release: "release-name"
        heritage: "Tiller"
        name: name-of-app
data:
    logback.xml: |-
      &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;configuration scan="true"&gt;
          &lt;xml-stuff&gt;
      &lt;/configuration&gt;
    application.yml: |-    
      application.yml.contents
</code></pre>

<p>I'm at my wit's end. What am I doing wrong? How do I make yaml snap back to recognizing configMap's own indentation and/or explicitly control it?</p>

<p>Try this:</p>
<pre><code>data:
    logback.xml: |-
        {{- .Files.Get &quot;application-resources/logback.xml&quot; | nindent 8 }}
    application.yml: |-
        {{- include &quot;application.yml&quot; . | nindent 8 -}}
</code></pre>
<p>I've removed the &quot;-&quot; from the 3rd line as it removes following whitespace.</p>
<p>You can also have a look at this GitHub Issue <a href="https://github.com/helm/helm/issues/3470" rel="noreferrer">#3470</a>.</p>
<p>If you need more help, you can check the documentation for <a href="https://helm.sh/docs/howto/charts_tips_and_tricks/" rel="noreferrer">Chart Development Tips and Tricks</a></p>
