<p>I have a folder with 3 json files in a <code>postman</code> folder. How can I create a ConfigMap using a Helm yaml template?</p>
<pre><code>kubectl create configmap test-config --from- 
file=clusterfitusecaseapihelm/data/postman/
</code></pre>
<p>The above solution works, but I need this as yaml file as I am using Helm.</p>

Vatan Soni
<p>Inside a Helm template, you can use the <code>Files.Glob</code> and <code>AsConfig</code> helper functions to achieve this:</p>
<pre><code>{{- (.Files.Glob &quot;postman/**.json&quot;).AsConfig | nindent 2 }}
</code></pre>
<p>Or, to give a full example of a Helm template:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: test-config
data:
  {{- (.Files.Glob &quot;postman/**.json&quot;).AsConfig | nindent 2 }}
</code></pre>
<p>See <a href="https://helm.sh/docs/chart_template_guide/accessing_files/#configmap-and-secrets-utility-functions" rel="noreferrer">the documentation</a> (especially the section on &quot;ConfigMap and secrets utility functions&quot;) for more information.</p>
