<p>So I had a ConfigMap with a json configuration file in it, like this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config-map
data:
  config.json: |+
  {
    &quot;some-url&quot;: &quot;{{ .Values.myApp.someUrl }}&quot;
  }
</code></pre>
<p>But I've moved to having my config files outside the ConfigMap's yaml, and just referencing them there, like this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config-map
data:
  config.json: |-
{{ .Files.Get .Values.myApp.configFile | indent 4 }}
</code></pre>
<p>But now I want my json to look like the following</p>
<pre class="lang-json prettyprint-override"><code>{
  &quot;some-url&quot;: &quot;{{ .Values.myApp.someUrl }}&quot;
}
</code></pre>
<p>The only thing I tried is what I just showed. I 'm not even sure how to look for this answer.</p>
<p>Is it even possible?</p>

onzinsky
<p>At the time of reading the file, its content is a string. It's not evaluated as template, and therefore you cannot use variables like you do.</p>
<p>However, helm has a function for this purpose specifically called <a href="https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function" rel="nofollow noreferrer">tpl</a>:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config-map
data:
  config.json: |- 
{{ tpl (.Files.Get .Values.myApp.configFile) $ | indent 4 }}
</code></pre>
<p>The tpl function takes a template string and renders it with some context. This is useful when you have template snippets in your values file or like in your case in some files content.</p>
