Terraform import issue

Hey, my Azure infra is managed by Terraform. Unfortunately there are multiple manual changes happened in multiple resources (VM OS disk rename, Data disks extensions) in Azure portal. As I needed to work on some other resource updates using Terraform module, TF plan pipelines shows force replacements. Could you please help me how to fix this?

When using Terraform you shouldn’t make manual changes elsewhere.

All changes, including the ones you are now seeing need to be made in the code. Take a look at what it is saying has changed and then adjust the code accordingly.

Please see my VM’s TF configurations;



Here OS disk is restored from backup so the OS disk name is not in pattern Hence TF is trying to modify the name from spcpwspvm05-osdisk-20230222-094442 to SPCPWSPVM05-OS

Need advise how to adjust the code here.

Is there anyone can help?