-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArgoCD clusters should list to find the cluster instead of get and check for NotFound #266
Comments
Hi @w4rgrum, Nicely done on all the digging. Yes, this is, unfortunately, not an ideal situation. We faced a similar issue recently (#247) when the response on the application get endpoint was changed to In the case of clusters, unfortunately, the ArgoCD API does not provide any form of filtering on the |
Opened argoproj/argo-cd#13363 to implement filtering on the cluster |
@onematchfox I see that the fix was implemented in argo-cd v2.8.0, any news on the TF provider fixes to be able to use the |
@w4rgrum yeah, I saw that too. Haven't had time to get around to the provider changes unfortunately. Need to give some thought to how best to implement as we still need to support |
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. |
Terraform Version, ArgoCD Provider Version and ArgoCD Version
Affected Resource(s)
Question
Got this issue when trying to update a cluster with TF that had been previously manually deleted on ArgoCD server side:
After some investigations on this issue I concluded this:
To retrieve a cluster from an ArgoCD server there are basically 2 ways:
However, since the implementation of argo-cd PR-7039 the 1) is not reliable as if the cluster is not found it will return a "fake" 403 instead of 404 for security reasons as the feature enabled cluster-level RBAC (see argo-cd discussion 10830)
Currently the provider uses the list api at create time: https://github.com/oboukili/terraform-provider-argocd/blob/master/argocd/resource_argocd_cluster.go#L94-L129
However for all other cases it uses a direct get and checks for
NotFound
(https://github.com/oboukili/terraform-provider-argocd/blob/master/argocd/resource_argocd_cluster.go#L167-L175) in order to ignore the error in that case, but this will never be returned because of the above-mentioned change.My question is: shouldn't the provider always use the list api to retrieve a cluster to be able to properly ignore a
cluster not found
case? (and thus to be more robust to unexpected changes that happened outside of TF)The text was updated successfully, but these errors were encountered: