<p>I can generate the <code>ConfigMap</code> from the directory but they are not translating the template directives or values. Below is an example of the <code>Release.Namespace</code> template directive not being output in the <code>ConfigMap</code>.</p>

<pre><code>.
|____Chart.yaml
|____charts
|____.helmignore
|____templates
| |____my-scripts.yaml
|____values.yaml
|____test-files
  |____test1.txt
</code></pre>

<pre><code>---
# templates/myscripts.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-scripts
  namespace: {{ .Release.Namespace }}
data:
  test.txt: |-
{{ .Files.Get "test-files/test1.txt" | indent 4}}
</code></pre>

<pre><code># test-files/test1.txt
test file
{{ .Release.Namespace }}
</code></pre>

<p>When I run <code>helm install . --dry-run --debug --namespace this-should-print</code> here's what I'm getting vs what I'm expecting:</p>

<p>Actual:</p>

<pre><code>---
# Source: test/templates/my-scripts.yaml
# templates/myscripts.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-scripts
  namespace: test
data:
  test.txt: |-
    # test-files/test1.txt
    test file
    {{ .Release.Namespace }}
</code></pre>

<p>Expected:</p>

<pre><code>---
# Source: test/templates/my-scripts.yaml
# templates/myscripts.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-scripts
  namespace: test
data:
  test.txt: |-
    # test-files/test1.txt
    test file
    this-should-print
</code></pre>

<p>Alternatively, I would be interested in every file in a specified directory being output in the format like:</p>

<pre><code>&lt;filename&gt;: |-
  &lt;content&gt;
</code></pre>

<p>I've found a way of doing it using the tpl function:</p>

<pre><code>---
# templates/myscripts.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-scripts
  namespace: {{ .Release.Namespace }}
data:
  test.txt: |-
{{ tpl ( .Files.Get "test-files/test1.txt" ) . | indent 4 }}
</code></pre>

<p>The new output is exactly as expected:</p>

<pre><code># templates/myscripts.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-scripts
  namespace: this-should-print
data:
  test.txt: |-
    # test-files/test1.txt
    test file
    this-should-print
</code></pre>

<p>And for bonus points, getting all files from a directory without having to update this list within the config map:</p>

<pre><code>---
# templates/myscripts.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-scripts
  namespace: {{ .Release.Namespace }}
data:
{{ tpl (.Files.Glob "groovy-scripts/*").AsConfig . | indent 4 }}
</code></pre>
