Hi @Petru Dumuta - The current means for validating ARM Templates is through the use of VSCode with the ARM Template extension: Create Azure Resource Manager templates with Visual Studio Code (Link)
This will give you the ability to at least validate the template and the second part of the same document discusses the creation of a parameters file.
Additionally, there is a means to crate a template spec: Create and deploy template spec (Preview) and the template spec can include a parameter values: Deploy a template spec.
With a Template Spec, you reference the resource ID of the template spec you desire to deploy. This along with working with ARM in VSCode and the creation of a parameters file, you can introduce some logic to handle and mitigate this. This Stack Overflow thread has some good information on the subject, with regard to running a template multiple times: Azure - do not allow Arm template to modify existing resources where the take away is that ARM by itself has no means to handle error or retry logic at this time, and you need to leverage a scripting and parameters file to dynamically handle the idempotent
aspect that you are seeking.
You might be better converting your templates to Powershell scripts (or REST API calls) that way you can check the state prior to creating / amending details.
This means you need to dynamically handle the deployment mode (Azure Resource Manager deployment modes) to ensure the process understands that the update is either incremental
or complete
.
When deploying your resources, you specify that the deployment is either an incremental update or a complete update. The difference between these two modes is how Resource Manager handles existing resources in the resource group that aren't in the template.
For Reference: