Through Terraform I am planning to manage Azure resource locks. My idea is to create a ReadOnly lock at the resource level. As per the Terraform documentation, below code can be used for that purpose.
resource "azurerm_management_lock" "resource-group-level" {
name = "resource-group-level"
scope = azurerm_resource_group.example.id
lock_level = "ReadOnly"
notes = "This Resource Group is Read-Only"
}
Now I am concerned about any subsequent modification to the resource. During the next execution cycle, any changes to the resource will fail since there is a ReadOnly lock on the resource. What I am hoping for is to delete the lock, do the modification and add the lock back.
How to handle such a scenario through Terraform?



