{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
  labels:
    app: {{ template "prometheus-cloudwatch-exporter.name" . }}
    chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
rules:
  - apiGroups: [""]
    resources: ["secrets","configmap"]
    resourceNames: ["{{ template "prometheus-cloudwatch-exporter.fullname" . }}"]
    verbs: ["get"]
{{- end }}