I believe the problem to be propagation of changes for Private DNS.
Give it 15-20 minutes to stabilise and retry.
I encountered this error after a destroy and (impatient) redeploy. I am using private endpoints, and running terraform from inside the vnet.