After days of troubleshooting i found out the problem was because of the s3 bucket prefix list id which i forgot to mention, i still don't really understand why the prefix is needed tho.
here is the portion of code which helped me :
resource "aws_vpc_security_group_egress_rule" "fe_egress_s3" {
description = "Allow fe tasks to pull image layers from S3"
security_group_id = aws_security_group.app_fe_sg.id
from_port = 443
to_port = 443
ip_protocol = "tcp"
prefix_list_id = aws_vpc_endpoint.s3.prefix_list_id
}