How remove In Azure App service Plan

Hi.
My task is under terraform migrate a few Azure service plans to one new plan.
I faced with an issue, that terraform can’t remove the service plan, because it is using by app.
I also tried remove service before module which migrate service plan, but it is showing error with loop. I can explain it that first module try remove web app but second module try to restore. That’s why probably they in the loop. I can manually remove in dev environment but I can’t do it in the production. That’s why I need make this operation with terraform. So what can you advice? How to fix this? Thanks in advance.