title: Not able to attach Target id(launch configurtion) to the target group of network load balancer in Terraform
body: <p>I am configuring a Terraform script for creating HA rabbitmq setup with auto scaling groups for all the instances. For creating auto scaling group I am creating launch configuration which will create auto scalable instance.</p>
  
  <p>I want to use a network load balancer in front of this instance so I have to create target group and target group attachments. Here I have to provide target_id(launch configuration id) to attach it with target group. But when applying script it shows the following error:</p>
  
  <pre><code>Error registering targets with target group: ValidationError: Instance ID 'rabbit' is not valid status code: 400, request id: 1cad37a8-b1da-416a-bc11-f50ae6b83cd2
  </code></pre>
  
  <p><strong>Terraform script</strong></p>
  
  <pre><code>resource "aws_lb" "rabbit" {
    name = "${local.cluster_name}-lb"
    load_balancer_type = "network"
    internal = "false"
    subnets = aws_subnet.subnet.*.id
    enable_cross_zone_load_balancing = "true"
    tags = {
      Name = "${local.cluster_name}-lb"
    }
  }
  
  resource "aws_lb_listener" "http" {
      load_balancer_arn = aws_lb.rabbit.arn
      protocol = "TCP"
      port = "80"
  
      default_action {
          type = "forward"
          target_group_arn = aws_lb_target_group.TCP80.arn
      }
  }
  
  resource "aws_lb_target_group" "TCP80" {
    name = "${local.cluster_name}-TCP80"
    vpc_id = aws_vpc.vpc.id
    target_type = "instance"
  
    protocol = "TCP"
    port = "80"
  
    health_check {
      protocol = "TCP"
      port     = 80
  
      # NLBs required to use same healthy and unhealthy thresholds
      healthy_threshold   = 3
      unhealthy_threshold = 3
  
      # Interval between health checks required to be 10 or 30
      interval = 10
    }
  }
  
  resource "aws_lb_target_group_attachment" "TCP80" {
    count = var.controller_count
    target_group_arn = aws_lb_target_group.TCP80.arn
    target_id        = aws_launch_configuration.rabbit.id
    port             = 80
  }
  
  resource "aws_launch_configuration" "rabbit" {
    name = "rabbit"
    image_id    = data.aws_ami.ubuntu.id
    instance_type = var.instance_type
    key_name    = "key_name"
  
    security_groups = [
        aws_security_group.rabbit-nodes.id,
    ]
  }
  
  resource "aws_autoscaling_group" "rabbit-node" {
    #name = "${var.name}-${var.environment_tag}-"
    name ="rabbit"
    #count = var.instance_count
    launch_configuration = aws_launch_configuration.rabbit.name
    vpc_zone_identifier  = aws_subnet.subnet.*.id
    min_size             = var.min_size
    max_size             = var.max_size
    desired_capacity     = var.desired_size
    termination_policies = ["OldestLaunchConfiguration", "Default"]
    #load_balancers       = ["${aws_lb.rabbit}"]
  
    health_check_type         = "EC2"
    health_check_grace_period = 300
  
    lifecycle {
      create_before_destroy = true
    }
  }
  </code></pre>