Migrating to a renamed resource


Recently several resource types related to Azure Backup were renamed and marked as deprecated - see https://github.com/terraform-providers/terraform-provider-azurerm/pull/5170.

According to suggestions in documentation https://www.terraform.io/docs/providers/azurerm/r/recovery_services_protected_vm.html I’ve used instructions from https://www.terraform.io/docs/providers/azurerm/guides/migrating-between-renamed-resources.html and tried to rename several resource types, e.g.

terraform state mv azurerm_recovery_services_protection_policy_vm.example azurerm_backup_policy_vm.example

but encountered next error with message:
Cannot move azurerm_recovery_services_protection_policy_vm.example
to azurerm_backup_policy_vm.example: resource types don’t match.

Seems like it’s limitation of terraform itself - see https://github.com/hashicorp/terraform/blob/93e29b71a4312649f6daebe4f39353aed5aa67d5/command/state_mv.go#L462. But I’m not sure.

Could you please tell me if I was doing something wrong or maybe article a bit outdated https://www.terraform.io/docs/providers/azurerm/guides/migrating-between-renamed-resources.html ?

Problem solved.

Seems like after releasing v2.0 of AzureRM provider guys have updated Azure Provider: Migrating to a renamed resource guide:

So we can use updated guide from now on.