terraform-provider-argocd icon indicating copy to clipboard operation
terraform-provider-argocd copied to clipboard

Add support of templatePatch in ApplicationSet (on ArgoCD 2.10)

Open dtrouillet opened this issue 1 year ago • 9 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

dtrouillet avatar Feb 20 '24 06:02 dtrouillet

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

KyriosGN0 avatar May 08 '24 09:05 KyriosGN0

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

KyriosGN0 avatar May 09 '24 12:05 KyriosGN0

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 03 '24 12:10 github-actions[bot]

not stale

dtrouillet avatar Oct 03 '24 13:10 dtrouillet

@dtrouillet is there a plan to upgrade the argocd dep to 2.10+ ?

KyriosGN0 avatar Oct 04 '24 12:10 KyriosGN0

@KyriosGN0 would you mind opening an issue for the dep update? Then we can discuss about the update there.

But from my point of view it's something we have to do soon as it's also sort of linked to #443

the-technat avatar Oct 04 '24 12:10 the-technat