<p>So I am trying to build a helm chart.</p>

<p>in my templates file I've got a file like:</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: config-map
data:
{{ Do something here to load up a set of files | indent 2 }}
</code></pre>

<p>I have another directory in my chart: <code>configmaps</code>
where a set of json files, that themselves will have templated variables in them:</p>

<pre><code>a.json
b.json
c.json
</code></pre>

<p>Ultimately I'd like to be sure in my chart I can reference:</p>

<pre><code>volumes:
   - name: config-a
     configMap:
       name: config-map
       items:
       - key: a.json
         path: a.json
</code></pre>

<p>I had same problem for a few weeks ago with adding files and templates directly to container.  </p>

<p>Look for the sample syntax: </p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-configmap-{{ .Release.Name }}
  namespace: {{ .Release.Namespace }}
  labels:
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
  nginx_conf: {{ tpl (.Files.Get "files/nginx.conf") . | quote }}
  ssl_conf: {{ tpl (.Files.Get "files/ssl.conf") . | quote }}
  dhparam_pem: {{ .Files.Get "files/dhparam.pem" | quote }}
  fastcgi_conf: {{ .Files.Get "files/fastcgi.conf" | quote }}
  mime_types: {{ .Files.Get "files/mime.types" | quote }}
  proxy_params_conf: {{ .Files.Get "files/proxy_params.conf" | quote }}
</code></pre>

<p>Second step is to reference it from deployment: </p>

<pre><code>  volumes:
  - name: {{ $.Release.Name }}-configmap-volume
    configMap:
      name:nginx-configmap-{{ $.Release.Name }}
      items:
        - key: dhparam_pem
          path: dhparam.pem
        - key: fastcgi_conf
          path: fastcgi.conf
        - key: mime_types
          path: mime.types
        - key: nginx_conf
          path: nginx.conf
        - key: proxy_params_conf
          path: proxy_params.conf
        - key: ssl_conf
          path: ssl.conf 
</code></pre>

<p>It's actual for now. Here you can find 2 types of importing: </p>

<ul>
<li>regular files without templating </li>
<li>configuration files with dynamic variables inside</li>
</ul>

<p>Please do not forget to read official docs: 
<a href="https://helm.sh/docs/chart_template_guide/accessing_files/" rel="noreferrer">https://helm.sh/docs/chart_template_guide/accessing_files/</a></p>

<p>Good luck! </p>
