<p>I have a bunch of secretKey in values.yaml like below. I need to add each value of <code>secretKey</code> as a key and decoded value in template.data like as a value like below.</p>
<p>How can I achieve this ?</p>
<pre><code>{{- range $externalSecretName, $externalSecret := .Values.externalSecrets }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: {{ $externalSecretName }}
spec:
  refreshInterval: 1m
  secretStoreRef:
    name: secret
    kind: SecretStore
  target:
    name: {{ $externalSecretName }}
    creationPolicy: Owner
    template:
      data:
        ## Needs to insert/add each secretKey value here like below
        {
          keyname1: &quot;{{ .keyname1 | b64dec }}&quot;.  
          keyname2: &quot;{{ .keyname2 | b64dec }}&quot;.  
        }

  data:
  {{- toYaml $externalSecret.data | nindent 4 }}
---
{{- end }}


values.yaml:
===========

extraEnvSecret:
  fromSecret:
    name: master-tf-address-handling
    data:
      PREFIX_KEYNAME1: keyname1
      PREFIX_KEYNAME2: keyname2

externalSecrets:
  demo-app:
    data:
      - secretKey: keyname1
        remoteRef:
          key: value1
      - secretKey: keyname2
        remoteRef:
          key: value1
</code></pre>

<pre><code>{{- range $externalSecretName, $externalSecret := .Values.externalSecrets }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: {{ $externalSecretName }}
spec:
  refreshInterval: 1m
  secretStoreRef:
    name: secret
    kind: SecretStore
  target:
    name: {{ $externalSecretName }}
    creationPolicy: Owner
    template:
      data:
        {
          {{- range $externalSecret.data }}
             {{ .secretKey }}: &quot;{{ .remoteRef.key | b64enc }}&quot;,
          {{- end }}
        }
  data:
    {{- toYaml $externalSecret.data | nindent 4 }}
{{- end }}
</code></pre>
