Target group traffic port override for auto scaling group

Hi.
We have a following situation.
Our target group port is set to 443 but our backend is listening on port 80.
Using AWS console we can easily override a traffic port during instance registration to the target group. However we are unable to override traffic port using aws_autoscaling_attachment.
Whatever we do the autoscaling instances are always set to send traffic to port 443.

Is there any way to tell terraform to override traffic port during aws_autoscaling_attachmen event.

Here is a relevant terraform code:

resource “aws_alb_target_group” “test” { name = “test” port = 443 protocol = “HTTPS” vpc_id = “${var.vpc_id}” deregistration_delay = 80
stickiness {
type = “lb_cookie”
}

health_check {                                                                                                                                                                                                                                 
  path = "/heartbeat"                                                                                                                                                                                                                          
  port = "80"                                                                                                                                                                                                                                  
  healthy_threshold = 3                                                                                                                                                                                                                        
  unhealthy_threshold = 3                                                                                                                                                                                                                      
  timeout = 5                                                                                                                                                                                                                                  
  interval = 50                                                                                                                                                                                                                                
  protocol = "HTTPS"
  matcher = "200"                                                                                                                                                                                                                            

}
}

resource “aws_autoscaling_attachment” “test” {
autoscaling_group_name = “${aws_autoscaling_group_auto_scale.id}”
alb_target_group_arn = “${aws_alb_target_group.test.arn}”
}

Regards.

In your scenario, you’re facing an issue with the target group port configuration for an Auto Scaling group in AWS. When using Terraform, the aws_autoscaling_attachment resource attaches an Auto Scaling group to a specified target group. However, as of my last update, Terraform’s AWS provider doesn’t support directly setting or overriding the target group port for each instance in the Auto Scaling group at the time of attachment.