# argocd_source_create-update.yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: guestbook
spec:
  goTemplate: true
  generators:
  - list:
      elements:
      - cluster: engineering-dev
        url: https://kubernetes.default.svc
        foo: bar
      # Update foo value with foo: bar
      # Application engineering-prod-guestbook labels will change to foo: bar
      # Delete this element
      # Application engineering-prod-guestbook will be kept
      - cluster: engineering-prod
        url: https://kubernetes.default.svc
        foo: baz
  template:
    metadata:
      name: '{{.cluster}}-guestbook'
      labels:
        foo: '{{.foo}}'
    spec:
      project: default
      source:
        repoURL: https://github.com/argoproj/argo-cd.git
        targetRevision: HEAD
        path: applicationset/examples/list-generator/guestbook/{{.cluster}}
      destination:
        server: '{{.url}}'
        namespace: guestbook
  syncPolicy:
    applicationsSync: create-update