Updating terraform deprecated resources

Azurerm provider upgrade from 2.72 to latest 3.55.0 version destroys the existing resources and then recreate it .
When we are upgrading it with the change in azurerm_linux_function_app and azurerm_windows_function_app . This destroys the existing functionapps and appservice plan and recreate the functionapp.

Is there any way we can prevent the resources destruction , as this will cause a downtime to the services.

Hello!

With the change in resource, terraform will indeed see the difference and interpret it as “this resource is no longer declared, therefore I must destroy it”. Just curious - have you tried using the moved declaration?

I haven’t tried this completely different resources, but perhaps it’s what you’re looking for? The only other option I can think of is to temporarily remove the resource from the state, then import it again under the new declaration – this would be a manual operation.