apiVersion: external-secrets.io/v1alpha1
kind: ExternalSecret
metadata:
  name: atadog-keys
spec:
  secretStoreRef:
    kind: ClusterSecretStore
    name: aws-store
  target:
    name: datadog-keys
    creationPolicy: Owner
  dataFrom:
    - key: datadog-keys
---
apiVersion: external-secrets.io/v1alpha1
kind: ExternalSecret
metadata:
  name: datadog-postgres-config
spec:
  secretStoreRef:
    kind: ClusterSecretStore
    name: aws-store
  target:
    name: datadog-postgres-config
    creationPolicy: Owner
    template:
      engineVersion: v2
      data:
        postgres.yaml: |
          cluster_check: true
          init_config:
          instances:
          {{ .endpointsList | fromJson | toYaml }}
  data:
    - secretKey: endpointsList
      remoteRef:
        key: datadog-rds-config        
---
apiVersion: external-secrets.io/v1alpha1
kind: ExternalSecret
metadata:
  name: datadog-init-job
spec:
  secretStoreRef:
    kind: ClusterSecretStore
    name: aws-store
  target:
    name: datadog-init-job
    creationPolicy: Owner
  dataFrom:
    - key: datadog-init-job
      
