title: Errors when creating ConfigMap from config files using Helm v3
body: <p>I'm using Helm3 (v3.2.4) on linux.  We have a number of config files that we keep in subfolers under the chart that I'm trying to build ConfigMaps from.   It almost works, but I have 3 issues:</p>
  <ol>
  <li>The error message at the end, don't know what's causing it</li>
  <li>I don't know how to make each configMap Key a fileName only - the $path var I used includes the folder for the file.  (SOLVED)</li>
  <li>The spacing and indentation on each item seems wrong and I don't know how to control it.</li>
  </ol>
  <p>Here is my filestructure:</p>
  <pre><code>└── fromfiles
      ├── charts
      ├── Chart.yaml
      ├── parser
      ├── receiver
      │   ├── 100_aws_beats_receiver_input_5044.conf
      │   ├── 100_aws_dmp_beats_receiver_input_5019.conf
      │   └── 100_cloud_foundry_receiver_input_5020.conf
      └── templates
          └── configMap_glob_files.yaml
  </code></pre>
  <p>Here is my configMap_glob_files.yaml file for generating the ConfigMap:</p>
  <pre><code>cat configMap_glob_files.yaml
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: {{ .Release.Name }}-glob-configmap
  data:
      {{ $currentScope := . }}
      {{ range $path, $_ :=  .Files.Glob  &quot;receiver/**.conf&quot; }}
          {{- with $currentScope}}
      {{ base $path }}: | -
              {{ .Files.Get $path | indent 4 }}
          {{- end }}
      {{ end }}
  </code></pre>
  <p>Here is one of the conf files:</p>
  <pre><code>cat 100_aws_beats_receiver_input_5044.conf
  input {
    beats {
      port =&gt; 5044
      host =&gt; &quot;0.0.0.0&quot;
      tags =&gt; [&quot;output_beats&quot;]
      add_field =&gt; {
        &quot;[es][port]&quot; =&gt; 5044
          }
    }
  }
  </code></pre>
  <p>Here is what happens when I run the <code>helm template</code> command:</p>
  <pre><code>[jdepaul@pu00cenvdi323 configfun]$ helm template multi-files/fromfiles --debug
  install.go:159: [debug] Original chart version: &quot;&quot;
  install.go:176: [debug] CHART PATH: /home/jdepaul/repos/configfun/multi-files/fromfiles
  
  ---
  # Source: fromfiles/templates/configMap_glob_files.yaml
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: RELEASE-NAME-glob-configmap
  data:
  
  
      100_aws_beats_receiver_input_5044.conf: | -  **(SOLVED)**
                  input {   **(This indentation is wrong...)**
        beats {
          port =&gt; 5044
          host =&gt; &quot;0.0.0.0&quot;
          tags =&gt; [&quot;output_beats&quot;]
          add_field =&gt; {
            &quot;[es][port]&quot; =&gt; 5044
              }
        }
      }
  
  ... the other two items in the list removed for brevity
  
  Error: YAML parse error on fromfiles/templates/configMap_glob_files.yaml: error converting YAML to JSON: yaml: line 8: did not find expected comment or line break
  helm.go:84: [debug] error converting YAML to JSON: yaml: line 8: did not find expected comment or line break
  YAML parse error on fromfiles/templates/configMap_glob_files.yaml
  helm.sh/helm/v3/pkg/releaseutil.(*manifestFile).sort
          /home/circleci/helm.sh/helm/pkg/releaseutil/manifest_sorter.go:146
  helm.sh/helm/v3/pkg/releaseutil.SortManifests
          /home/circleci/helm.sh/helm/pkg/releaseutil/manifest_sorter.go:106
  helm.sh/helm/v3/pkg/action.(*Configuration).renderResources
          /home/circleci/helm.sh/helm/pkg/action/action.go:159
  helm.sh/helm/v3/pkg/action.(*Install).Run
          /home/circleci/helm.sh/helm/pkg/action/install.go:238
  main.runInstall
          /home/circleci/helm.sh/helm/cmd/helm/install.go:229
  main.newTemplateCmd.func1
          /home/circleci/helm.sh/helm/cmd/helm/template.go:66
  github.com/spf13/cobra.(*Command).execute
          /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842
  github.com/spf13/cobra.(*Command).ExecuteC
          /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950
  github.com/spf13/cobra.(*Command).Execute
          /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
  main.main
          /home/circleci/helm.sh/helm/cmd/helm/helm.go:83
  runtime.main
          /usr/local/go/src/runtime/proc.go:203
  runtime.goexit
          /usr/local/go/src/runtime/asm_amd64.s:1357
  </code></pre>