{{- if and (not .Values.aws.role) (not .Values.aws.secret.name) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
  labels:
    app: {{ template "prometheus-cloudwatch-exporter.name" . }}
    chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
type: Opaque
data:
  {{ if .Values.aws.aws_access_key_id }}
  aws_access_key_id: {{ .Values.aws.aws_access_key_id | b64enc | quote }}
  {{ end }}
  {{ if .Values.aws.aws_secret_access_key }}
  aws_secret_access_key: {{ .Values.aws.aws_secret_access_key | b64enc | quote }}
  {{ end }}
{{- end }}
