<p>I am following example mentioned in <a href="https://helm.sh/docs/chart_template_guide/accessing_files/" rel="nofollow noreferrer">https://helm.sh/docs/chart_template_guide/accessing_files/</a>.</p>
<p>I am able to load toml files in configmap, but when I use rego files, I am getting an error:</p>
<pre class="lang-sh prettyprint-override"><code>cat multiple_config.yaml
</code></pre>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  {{- $files := .Files }}
  {{- range tuple &quot;label-check.rego&quot; }}
  {{ . }}: |-
    {{ $files.Get . }}
  {{- end }}
</code></pre>
<pre class="lang-sh prettyprint-override"><code>Error :-
Error: YAML parse error on opa/templates/multiple_config.yaml: error converting YAML to JSON: yaml: line 14: could not find expected ':'
</code></pre>

Shashank
<p>The error you are seeing <a href="https://github.com/helm/helm/issues/2004" rel="nofollow noreferrer">is a common issue</a> 🧩. It's probably an indentation inconsistency in your rego file. You can see in this example that rego <a href="https://www.openpolicyagent.org/docs/v0.12.2/kubernetes-admission-control/#3-deploy-opa-on-top-of-kubernetes" rel="nofollow noreferrer">can perfectly be used in ConfigMaps</a>.</p>
<p>You could try this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  {{- $files := .Files }}
  {{- range tuple &quot;label-check.rego&quot; }}
  {{ . }}: |-
{{ $files.Get . | indent 4 }}
  {{- end }}
</code></pre>
<p>✌️</p>
