Restructuring project without deleting IOThub

Hello,
I have created one terraform resource i.e. : module.azure-service.azurerm_iothub.IOTHubs
As I am doing restructuring of project so would like to move create IOThub to module.azure-service.azurerm_iothub.IOTHubs["project"] How can I achieve this without deleting existing IOThub ?I am planning to take following steps

  1. terraform state rm module.azure-service.azurerm_iothub.IOTHubs
  2. terraform import module.az-IOT.azure_iothub.IOTHubs["project"] /subcription/.......

is this the correct way ?

I don’t want to lose the devices added in the IOT hub and also anyconfig so that safe and zero downtime migration can be done on production .

Actually after restructuring when executed terraform plan it came as below :


 terraform plan | grep "# module"
  # module.az-IOT.azurerm_iothub.IOTHubs["project"] will be created
  # module.az-IOT.azurerm_iothub.IOTHubs["project1"] will be created
  # module.az-IOT.azurerm_iothub_shared_access_policy.sap["project"] will be created
  # module.az-IOT.azurerm_iothub_shared_access_policy.sap["project1"] will be created
  # module.az-IOT.azurerm_resource_group.az-rg-group["project"] will be created
  # module.az-IOT.azurerm_resource_group.az-rg-group["project1"] will be created
  # module.azure-service.azurerm_iothub.IOTHubs will be destroyed
  # module.azure-service.azurerm_iothub_shared_access_policy.sap will be destroyed

Kindly suggest so can plan restructuring of productions quite swiftly.

Anyone can please give pointers ?