The terraform state mv command allows for moving an existing remote resource
to be specified by a different instance resource address in Terraform. Said
another way, state mv can also move a resource's state between Terraform
projects without tearing down or rebuilding the resource itself.
The following command moves the packet_device.worker resource into a module.
terraform state mv packet_device.worker module.worker.packet_device.worker
The command also accepts -state and -state-out options, which support moving
state into or out of a provided local file. These options can be especiall useful
if you can't specify a module to the move the state into or out of directly because
the Terraform projects cannot access one another.
Detailed example with local files here.