Unable to use regional endpoints with AWS provider

I’m having a problem with particularly Sts endpoint when using terraform. We have a Jenkins instance in a private vpc which uses terraform when deploying. Deployments crash often with error Post https://sts.amazonaws.com/: net/http: TLS handshake timeout. We are experiencing high latency to sts.amazonaws.com so I figured that we should use regional endpoint sts.eu-west-1.amazonaws.com instead. The problem is that I am unable to achieve this. I have tried setting an endpoints block in our provider config:

provider “aws” {
version = “2.34.0”
endpoints {
sts = “sts.eu-west-1.amazonaws.com
}
}

But even with this block the error message remains the same. I also tried adding https://sts.eu-west-1.amazonaws.com but it didn’t help.

Is there another way to force terraform to use regional endpoints?