argoproj-labs / terraform-provider-argocd

Terraform provider for Argo CD
Mozilla Public License 2.0
424 stars 89 forks source link

ArgoCD provider wipes `notified.notifications.argoproj.io` annotation on updates #173

Open luke-plausin-kidsloop opened 2 years ago

luke-plausin-kidsloop commented 2 years ago

Hi there,

I have a problem with my setup that is causing a lot of duplicate notifications to get sent when using the Terraform ArgoCD provider.

It seems that the ArgoCD notifications project uses an annotation - notified.notifications.argoproj.io to track whether it has already sent out notifications for a particular app. The annotation is added directly to the app itself, and does not currently appear on any Terraform diffs generated with the ArgoCD provider. When an update is made through the Terraform ArgoCD provider, this annotation seems to get wiped out by the provider, and then recreated by the argocd notification service (with a duplicate sent out). This is causing a lot of duplicate notifications to get sent, and defeats the point of having the notified.notifications.argoproj.io annotation.

It seems that a merge request was accepted a while back to ignore all notified.notifications.argoproj.io annotations within the provider. The reason was to try and stop irrelevant details from always appearing in the terraform diff.

https://github.com/oboukili/terraform-provider-argocd/pull/71

I believe that this is what causes the annotation to get wiped. I think the approach of ignoring the annotation altogether is wrong, and the reporter of that issue could have used a Terraform lifecycle statement if they did not want the ArgoCD notifications annotation to appear in their diff.

  lifecycle {
    ignore_changes = [
      metadata[0].annotations["notified.notifications.argoproj.io"]
    ]
  }

Is it possible to preserve this annotation in some way? Even if it does appear in the diff I think it's better to be explicit about these changes in Terraform updates rather than to silently ignore and then change the values. I'm also keen to hear if there are any workarounds that could help.

Thanks

github-actions[bot] commented 1 month ago

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.