argoproj-labs/terraform-provider-argocd

Add support of templatePatch in ApplicationSet (on ArgoCD 2.10)

dtrouillet opened this issue · 6 comments

Description

A new parameter named templatePatch allow to add more control on Application template in ApplicationSet. More information here

Potential Terraform Configuration

locals {
  mytemplate = <<EOT
      spec:
      source:
        helm:
          valueFiles:
          {{- range $valueFile := .valueFiles }}
            - {{ $valueFile }}
          {{- end }}
    {{- if .autoSync }}
      syncPolicy:
        automated:
          prune: {{ .prune }}
    {{- end }}
    EOT
  project = "my-project"
}

resource "argocd_application_set" "test" {
  metadata {
    name      = "my-applicationset"
    namespace = "argocd"
  }

  spec {
    generator {
      clusters {
        selector {
          match_labels = {
            "env" = "qa"
          }
        }
      }
    }
    go_template = true
    templatePatch = local.mytemplate
    template {
      metadata {
        name = "test-{{ .name }}"
      }
      spec {
        destination {
          namespace = "my-ns"
          server    = "{{ .server }}"
        }
        project = local.project

        source {
          repo_url        = "{{ .url  }}"
          path            = "{{ .chart  }}"
          target_revision = "{{ .branch  }}"
        }
      }
      source {
        repo_url        = "{{ .url }}"
        ref             = "local"
        target_revision = "{{ .branch }}"
        path            = ""
      }
    }
  }
}

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Hey, I would like to work on this,
I'll try to open a PR this weekend

Hi, @dtrouillet, @onematchfox, in order to use templatePatch from the go package we need to update to argocd go dep to 2.10 at least,
is there some guide on how to upgrade dependency of the project?
i've tried some thing but it is breaking the build, seems to be some transitive dependency