title: Kubernetes helm, Files.Get and variables
body: <p>I'm trying to dynamically specify the name of a file to include in a configmap.yaml, using the Helm templating language.</p>
  
  <p>Here is an example:</p>
  
  <pre><code>{{- $filename := .Values.KRB5_REALM -}}
  apiVersion: v1
  data:
    # When the config map is mounted as a volume, these will be created as files.
    krb5.conf: |
  {{ .Files.Get $filename".krb5.conf" | indent 4 }}
  kind: ConfigMap
  metadata:
    name: {{ template "myapp.fullname" . }}
    labels:
      heritage: {{ .Release.Service }}
      release: {{ .Release.Name }}
      chart: {{ .Chart.Name }}-{{ .Chart.Version }}
      app: {{ template "myapp.name" . }}
      environment: {{ .Values.environment }}
  </code></pre>
  
  <p>The above code results in an error.</p>
  
  <p>I've tried several variations but without any success, such as:</p>
  
  <pre><code>{{ .Files.Get .Values.KRB5_REALM".krb5.conf" | indent 4 }}
  </code></pre>
  
  <p>How can I resolve this issue?</p>