Skip to content

argocd_repository_credentials: ID is set to URL instead of ID #815

@jervi

Description

@jervi

When creating an argocd_repository_credentials resource, there's no way to give it a proper name, which means Argo will create a secret called something like creds-012345678. Furthermore, the argocd_repository_credentials doesn't expose this generated name anywhere. The actual id field is set to URL instead.
This makes it hard to use the credentials with for instance the pull_request generator in an ApplicationSet, because it requires the actual name of the secret.

This can probably be solved in one of two ways:

  • Let the user provide a well defined name for the argocd_repository_credentials resource; or
  • Return the generated id/name instead of the URL.

Terraform Version, ArgoCD Provider Version and ArgoCD Version

Terraform version: 1.11.3
ArgoCD provider version: 7.12.5
ArgoCD version: 3.3.0

Affected Resource(s)

  • argocd_repository_credentials

Terraform Configuration Files

resource "argocd_repository_credentials" "gh-creds-platform-engineering" {
  url                           = "https://acme.ghe.com/platform-engineering/"
  githubapp_id                  = "1234"
  githubapp_installation_id     = "5678"
  githubapp_enterprise_base_url = "https://acme.ghe.com/api/v3"
  githubapp_private_key         = jsondecode(data.aws_secretsmanager_secret_version.argocd_repo_creds.secret_string)["githubAppPrivateKey"]
}

# Inside argocd_application_set:
generator {
  pull_request {
    requeue_after_seconds = 120
    github {
      api             = "https://api.acme.ghe.com"
      owner           = "platform-engineering"
      repo            = "backstage"
      app_secret_name = "creds-152247523" # Need to hardcode secret reference here, because there's no way to get the correct ID (`argocd_repository_credentials.gh-creds-platform-engineering.id` returns `https://acme.ghe.com/platform-engineering/`)
    }
  }
}

Steps to Reproduce

  1. Create an argocd_repository_credentials like above
  2. Try to get the id from the resource, like argocd_repository_credentials.my_repo_creds.id

Expected Behavior

The id/name of the resource should be returned, e.g. creds-152247523.

Actual Behavior

The URL is returned instead, e.g. https://acme.ghe.com/platform-engineering/.

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

    bugSomething isn't workingon-holdIssues or Pull Requests with this label will never be considered staleupstream-dependencyIssue depends on changes being made to upstream dependencies (e.g. `argoproj/argo-cd`)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions