<p>I am trying to create a secret from a JSON value but I keep getting this error executing <code>"secrets.yaml" at &lt;b64enc&gt;: wrong type for value; expected string; got map[string]interface {}</code> when I do <code>helm install</code>.</p>

<p><strong>secrets.yaml</strong></p>

<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: cloudsql-instance-credentials
  namespace: wp-{{ .Values.name }}
  labels:
    app: wp-{{ .Values.name }}
type: Opaque
data:
  credentials.json: {{ .Values.dbCred | b64enc }}
</code></pre>

<p><strong>values.yaml</strong></p>

<pre><code>dbCred: {
  'type': '',
  'project_id': '',
  'private_key_id': '',
  'private_key': '-----BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY-----\n',
  'client_email': '',
  'client_id': '',
  'auth_uri': '',
  'token_uri': '',
  'auth_provider_x509_cert_url': '',
  'client_x509_cert_url': ''
}
</code></pre>

<p>You can fix this by changing <code>{{ .Values.dbCred | b64enc }}</code> to <code>{{ toJson .Values.dbCred | b64enc }}</code></p>
