{{ if .Values.openfga.enabled }}
{{- range .Values.atlantis.envs }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: prod-openfga
  namespace: argocd
  annotations:
    argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  destination:
    namespace: openfga
    server: https://kubernetes.default.svc
  project: aux
  # ignoreDifferences:
  # - group: apps
  #   kind: StatefulSet
  #   jsonPointers:
  #   - /spec/persistentVolumeClaimRetentionPolicy
  syncPolicy:
    managedNamespaceMetadata:
      labels:
        component: aux
    syncOptions:
      - CreateNamespace=true
      - ApplyOutOfSyncOnly=true
    automated:
      prune: true
      selfHeal: true
  sources:
  - repoURL: https://openfga.github.io/helm-charts
    targetRevision: 0.2.21
    chart: openfga
    helm:
      valueFiles:
      - $values/values/openfga/values-prod.yaml
  - repoURL: https://gitlab.com/oceanbox/manifests.git
    targetRevision: main
    ref: values
{{- end }}
{{- end }}
