moved {
from = aws_instance.a
to = aws_instance.b
}
If state holds an object at the old address, OpenTofu renames it to the new address before planning. The plan then treats it as if it had always lived there — nothing is destroyed.
moved {
from = aws_instance.web
to = module.web.aws_instance.this
}
The OpenTofu docs call removing a moved block “generally a breaking change”: anyone still on the old address would get a plan that deletes the object. Keep them, especially in shared modules. In a private module, remove them only when every user has applied the new version.
Examples use OpenTofu (tofu); in Terraform the commands start with terraform. Check the documentation for your version before relying on a feature.
Tell us what you are trying to fix. No preparation needed.