Update existing resources and modify in tfstate

I have created 5 vm’s but the order was wrong when it provisioned and i create the order through ansible. Due to bug in ansible version i used the order came in random manner.

How can we update the tfstate file to fix the order using terraform import. I found a way to update index_key to fix order issue but i don’t want to update it manually in tfstate file directly.