<p>I have a helm chart that is creating a config map for which I am passing content as a value from terraform using helm_release.</p>
<p>values.yml: default is empty</p>
<pre><code>sql_queries_file: &quot;&quot;
</code></pre>
<p>helm template for configmap:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: sql-queries
data:
{{ .Values.sql_queries_file }}
</code></pre>
<p>terraform file:</p>
<pre><code>resource &quot;helm_release&quot; &quot;example&quot; {
............
..................
  set {
    name  = &quot;sql_queries_file&quot;
    value = file(./sql_queries.sql)
  }
}
</code></pre>
<p>I have a sql_queris.sql fine inside terraform folder with sample data below.</p>
<pre><code>-- From http://docs.confluent.io/current/ksql/docs/tutorials/basics-docker.html#create-a-stream-and-table

-- Create a stream pageviews_original from the Kafka topic pageviews, specifying the value_format of DELIMITED
CREATE STREAM pageviews_original (viewtime bigint, userid varchar, pageid varchar) WITH (kafka_topic='pageviews', value_format='DELIMITED');

</code></pre>
<p>Error:</p>
<pre><code>Failed parsing key sql_queries_file with value &lt;entire content here&gt;
</code></pre>
<p>Is this the right way? or is there a better way?</p>

SNR
<p>I would use <code>filebase64</code> to get the file with terraform to avoid templating issues. You can unmarshal it in helm like this: <code>{{ b64dec .Values.sql_queries_file }}</code>. By the way you should use data field in configMaps like this:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: sql-queries
data: 
  sql_queries.sql: |-
    {{ .Values.sql_queries_file | nindent 4 }}
#   {{ b64dec .Values.sql_queries_file | nindent 4 }} if you want to unmarshal
</code></pre>
<p>Edit: fixed typo in answer.</p>
