<p>the configmap.yaml</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include &quot;test.fullname&quot; . }}-config-map
data:
  brokerConf: |
    {{ .Values.configmap }}


</code></pre>
<p>the below values.yaml is right.</p>
<pre><code>configmap: |
  key=values
</code></pre>
<p>but the values.yaml is wrong</p>
<pre><code>configmap: |
  key=values
  key2=values2

</code></pre>
<p>the helm template core content is</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: test-config-map
data:
  brokerConf: |
    key=values
key2=values2

</code></pre>
<p>the error</p>
<pre><code>Error: YAML parse error on test/templates/config-map.yaml: error converting YAML to JSON: yaml: line 9: could not find expected ':'
helm.go:84: [debug] error converting YAML to JSON: yaml: line 9: could not find expected ':'
YAML parse error on v5-proxy/templates/config-map.yaml
helm.sh/helm/v3/pkg/releaseutil.(*manifestFile).sort
    helm.sh/helm/v3/pkg/releaseutil/manifest_sorter.go:146
helm.sh/helm/v3/pkg/releaseutil.SortManifests
    helm.sh/helm/v3/pkg/releaseutil/manifest_sorter.go:106
helm.sh/helm/v3/pkg/action.(*Configuration).renderResources
    helm.sh/helm/v3/pkg/action/action.go:165
</code></pre>
<p>how to fix it?</p>

<p>You may update the <code>configmap</code> as below:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: config-map
data:
  brokerConf:
    {{ .Values.configmap| indent 4|trim }}
</code></pre>
<p>The error is caused because the 2nd line in <code>data.brokerConf</code> is not indented properly. Something like below, where <code>key2=values2</code> is an invalid statement in yaml world, the correct is <code>key2: values2</code>.</p>
<pre><code>configmap: 
  key=values
key2=values2
</code></pre>
<p>To fix it we have to use <code>indent</code>, but it will do indent the first line additionally. To <a href="https://github.com/Masterminds/sprig/issues/54#issuecomment-360572045" rel="nofollow noreferrer">address that</a>, <code>trim</code> is used.</p>
