The following is a semi-automated (or semi-manual, if you're a glass-half-empty person) way of generating terraform state mv
commands to move existing resources to new paths.
It does not use a Terraform plan file, as this is often not conveniently available (e.g. when using Terraform Cloud).
Tested with Terraform 0.12, 0.13 and 0.14 output.
Note: if you're not using Terraform Cloud, you might want to try some of the proper tooling other people have built, such as https://github.com/mbode/terraform-state-mover.