Error after terraform hashicorp/aws version to 5

We recently upgraded the version to 5 but getting the error -

validation error - You must specify a subnet ID for each subnet mapping

When I ran the plan its deleting 3 subnet_mapping and creating 5 subnet_mapping out of which 3 subnet_mapping has proper allocation_id, outpost_id and subnet_id and 2 subnet_mapping has only outpost_id. And that is the reason I think I am getting the error but not sure how to fix can someone help