{{- if and (not .Values.awsRole) (and .Values.awsAccessKeyId .Values.awsSecretAccessKey) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "fluentd-cloudwatch.fullname" . }}
  labels:
    app: {{ template "fluentd-cloudwatch.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
type: Opaque
data:
{{- if .Values.awsAccessKeyId }}
  AWS_ACCESS_KEY_ID: {{ .Values.awsAccessKeyId | b64enc }}
{{- end }}
{{- if .Values.awsSecretAccessKey }}
  AWS_SECRET_ACCESS_KEY: {{ .Values.awsSecretAccessKey | b64enc }}
{{- end }}
{{- end }}
