Amazon Linux2 giving error for 'terraform init'

Hi there, I have been using terraform on an RHEL vm in aws ec2 without any issues. Just now tried installing on amazon linux2 using the steps shown on official documentation. However, i get this error when i do init:

Error: error parsing HTTP proxy URL: parse “proxy_vpc-xxxx:nnnn”: first path segment in URL cannot contain colon

I get this error only when i use backend as s3. No issue if i use local folder as backend.

we do have http_proxy & https_proxy etc., set in env variables (same as in RHEL) but i never got this error while using RHEL. I am even able to curl to external URLs (which go thru our proxy) and they work fine even on the same amazon linux vm. Any idea what could be the issue? Cheers.

My config:

required_providers {
aws = {
source = “hashicorp/aws”
version = “5.10.0”
}
}
required_version = “>= 1.0.0”
backend “s3” {
bucket = “tf-insights-state”
key = “dev-al2/tf-state”
region = “eu-west-1”
}