title: How to create a config map from a file in helm?
body: <p>I have a container running in a pod which requires a single config file.  The deployment/service etc are deployed using helm, and ideally I'd like to use the same method to setup the config, and if possible, I'd like to use helm's templating engine to template the config file.</p>
  
  <p>I came across this:
  <a href="https://www.nclouds.com/blog/simplify-kubernetes-deployments-helm-part-3-creating-configmaps-secrets/" rel="nofollow noreferrer">https://www.nclouds.com/blog/simplify-kubernetes-deployments-helm-part-3-creating-configmaps-secrets/</a></p>
  
  <p>I have the following file structure:</p>
  
  <pre><code>/chart
    /templates
      my-config-map.yaml
    /config
      application.config
  </code></pre>
  
  <p>and my-config-map.yaml contains the following:</p>
  
  <pre><code>apiVersion: v1
  kind: ConfigMap
  metadata:
    name: my-config
    labels:
      app: {{ template "app.prefix" . }}
  data:
    {{ (tpl (.Files.Glob "config/*").AsConfig . ) | indent 2 }}
  </code></pre>
  
  <p>When I run this command:</p>
  
  <pre><code>kubectl get configmaps my-config -n my-namespace -o yaml
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>apiVersion: v1
  kind: ConfigMap
  metadata:
    creationTimestamp: 2019-07-26T11:11:05Z
    labels:
      app: my-app
    name: my-config
    namespace: my-namespace
    resourceVersion: "2697856"
    selfLink: &lt;selflink&gt;
    uid: 0fe63ba8-af96-11e9-a73e-42010af00273
  </code></pre>
  
  <p>Note that it does not appear to have any data in it.  However if I create it from the command line using this command:</p>
  
  <pre><code>kubectl --namespace my-namespace create configmap my-config --from-file=application.conf
  </code></pre>
  
  <p>I get this, which does appear to contain the data:</p>
  
  <pre><code>apiVersion: v1
  data:
    application.conf: |-
      conf {
        ...
  kind: ConfigMap
  metadata:
    creationTimestamp: 2019-07-26T11:00:59Z
    name: my-config
    namespace: my-namespace
    resourceVersion: "2695174"
    selfLink: &lt;selflink&gt;
  </code></pre>
  
  <p>What exactly am I doing wrong?</p>