{{ range $index, $element := .Values.vault.secrets }}
{{- $vaultRole := $element.vaultRole | default $.Values.vault.role }}
---
apiVersion: ricoberger.de/v1alpha1
kind: VaultSecret
metadata:
  name: {{ include "common.names.fullname" $ }}-{{ $element.name }}
spec:
  type: {{ $element.type }}
  path: {{ $element.path }}
  {{- if $vaultRole }}
  vaultRole: {{ $vaultRole }}
  {{- end }}
  {{- range $k, $v := $element }}
  {{- if (not (has $k (list "name" "type" "path" "vaultRole"))) }}
  {{ $k }}: {{ $v }}
  {{- end }}
  {{- end }}
{{- end }}
