Skip to content

feature(datasource): support more argocd datasource #724

@incubator4

Description

@incubator4

Description

Currently, the Argo CD Terraform provider only supports the argocd_application data source. This is very useful, but it would be a significant enhancement to also have data sources for other core Argo CD resources.
Such as:

  • argocd_applicationset
  • argocd_project
  • argocd_cluster

Having these data sources would allow us to read existing configurations directly from Argo CD, which is essential for managing dependencies and integrating with other Terraform resources. For example, we could use a data source to get details about an existing ApplicationSet or look up a specific project's configuration before creating or managing other resources.

I'm glad to contribute code for this feature.

Potential Terraform Configuration

datasource "argocd_cluster" "cluster" {
  # or any other selector
  name = "example-cluster"
}

datasource "argocd_project" "project" {
  # or any other selector
  name = "example-project"
}

resource "argocd_application" "multiple_sources" {
  metadata {
    name      = "helm-app-with-external-values"
    namespace = "argocd"
  }

  spec {
    project = datasource.argocd_project.project.name
    source {
      repo_url        = "https://charts.helm.sh/stable"
      chart           = "wordpress"
      target_revision = "9.0.3"
      helm {
        value_files = ["$values/helm-dependency/values.yaml"]
      }
    }

    source {
      repo_url        = "https://github.com/argoproj/argocd-example-apps.git"
      target_revision = "HEAD"
      ref             = "values"
    }

    destination {
      server    = datasource.argocd_cluster.cluster.server
      namespace = "default"
    }
  }
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeston-holdIssues or Pull Requests with this label will never be considered stalevalidThis issue has been verified by a maintainer and can either be reproduced or is otherwise right.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions