Skip to content

argocd_repository does not handle same repo used in multiple projects on same ArgoCD server properly #719

@ryan-grenz-evelyn

Description

@ryan-grenz-evelyn

I have 2 separate terraform runs, each of which sets up a project, and then inside that project: a github repository, and some applications which will use that repository. Both terraform runs deploy onto the same ArgoCD server, and the github repository used is the same repository.

The applications deploy fine, but only one of the repository deployments works. The second one fails because it is trying to move the repository to the other project. It should be creating the same repository in both projects which is valid in ArgoCD.

  # module.cd.argocd_repository.deployment_configs[0] will be updated in-place
  ~ resource "argocd_repository" "deployment_configs" {
      ~ connection_state_status   = "Successful" -> (known after apply)
      ~ id                        = "https://github.com/blah/blah" -> (known after apply)
      ~ inherited_creds           = true -> (known after apply)
        name                      = "deployment-configs"
      ~ project                   = "project-A" -> "project-B"
        # (7 unchanged attributes hidden)
    }

This is a problem I raised a ticket about 5 months ago : #597 and it got fixed in 7.5.2 not long afterwards. I recently upgraded to 7.10.1 and found this problem, but I have a feeling may have regressed since migrating argocd_repository to the plugin framework in 7.9.0. It looks like it is occuring because the ID of the resource is the URL of the repo, but the project scope is not taken into consideration when deciding what action to take.

Terraform Version, ArgoCD Provider Version and ArgoCD Version

Terraform version:
ArgoCD provider version: 7.10.1
ArgoCD version: 2.14.9

Affected Resource(s)

  • argocd_repository

Steps to Reproduce

See #597 (comment)

Expected Behavior

I would expect to see 2 separate ArgoCD repositories in the same ArgoCD server, both using the same Github URL but in 2 distinct projects.

Actual Behavior

As you can see in the plan it wants to move the repo of the same ID to the other project.

Important Factoids

References

#597

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 working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions