HELP HELP HELP > Please, I need assistance with writing a terraform module to rerun a failed a task in azure

I hope somebody can help me to solve this issue and understand how to implement the best approach. I have a number of situations where I need to retry a task n-times if it fails.

My ask is, I need help writing a Terraform module to monitor an azure task which is to restart it in case it encounters an exception. retry logic). If an exception is thrown, the task should be retried up to the max-retry count.