<p>I am trying to access a file inside my helm templates as a config map, like below. I get an error as below. </p>

<p>However, it works when my application.yml doesn't have nested objects (Eg - name: test). Any ideas on what I could be doing wrong?</p>

<p><strong>config-map.yaml:</strong></p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
 name: {{ .Release.Name }}-configmap

data:
 {{.Files.Get “application.yml”}}
</code></pre>

<p><strong>application.yml:</strong></p>

<pre><code>some-config:
 application:
   name: some-application-name
</code></pre>

<p><strong>ERROR:</strong></p>

<pre><code>*ConfigMap in version “v1" cannot be handled as a ConfigMap: v1.ConfigMap.Data: ReadString: expects ” or n, but found {, error found in #10 byte of ...|ication”* 

</code></pre>

zooes
<p>As per <a href="https://helm.sh/docs/chart_best_practices/#formatting-templates" rel="nofollow noreferrer">documentation</a>:</p>

<blockquote>
  <p>Templates should be indented using two spaces (never tabs).
  Template directives should have whitespace after the opening braces and before the closing braces.</p>
</blockquote>

<p>finally it should looks like:</p>

<pre><code>{{ .Files.Get "application.yml" | nindent 2 }}
or 
{{- .Files.Get "application.yml" | nindent 2 }}
to chomp whitespace on the left
</code></pre>
