Renaming without Destroying
If you rename a resource in your code, OpenTofu thinks you want to delete the old one and create a new one. This is bad for databases!
In modern OpenTofu, use the moved block:
hcl
moved {
from = aws_instance.old_name
to = aws_instance.new_name
}
This updates the state file during the next apply without touching the actual cloud resource.