{{- if not .Values.vcsSecretName }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "atlantis.fullname" . }}-webhook
  labels:
    app: {{ template "atlantis.name" . }}
    chart: {{ template "atlantis.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
  {{- if .Values.github }}
  github_token: {{ required "github.token is required if github configuration is specified." .Values.github.token | b64enc }}
  github_secret: {{ required "github.secret is required if github configuration is specified." .Values.github.secret | b64enc }}
  {{- end}}
  {{- if .Values.gitlab }}
  gitlab_token: {{ required "gitlab.token is required if gitlab configuration is specified." .Values.gitlab.token | b64enc }}
  gitlab_secret: {{ required "gitlab.secret is required if gitlab configuration is specified." .Values.gitlab.secret | b64enc }}
  {{- end}}
  {{- if .Values.bitbucket }}
  bitbucket_token: {{ required "bitbucket.token is required if bitbucket configuration is specified." .Values.bitbucket.token | b64enc }}
  {{- if .Values.bitbucket.baseURL }}
  bitbucket_secret: {{ required "bitbucket.secret is required if bitbucket.baseURL is specified." .Values.bitbucket.secret | b64enc }}
  {{- end}}
  {{- end }}
{{- end }}
