Search code examples
terraformterraform-provider-azure

delete and create resource instead of change in terraform


I have created dozens of resources using terraform azurerm, but I want a particular resource that needs to be deleted and created every time I do terraform apply

Reason : After applying change to that resource , it's not functioning as expected.

Resource : Azure Alert (azurerm_monitor_scheduled_query_rules_alert_v2)

I made some changes on Arguments , after that alert stopped working. And I deleted above alert manually from azure portal , and did terraform apply it worked.


Solution

  • Have you tried to taint the resource?
    terraform taint command new in terraform v0.15.2:

    terraform apply -replace="resource.name"
    

    taint (deprecated):

    terraform taint resource.name