title: The ELB could not be updated due to the following error: Primary taskset target group is not behind any rule for listener
body: <p>I try AWS CodeDeploy for ECS Blue/Green Deployment.</p>
  <p>I use terraform to definition codedeploy.</p>
  <p>this below my terraform code.</p>
  <pre><code>resource &quot;aws_codedeploy_app&quot; &quot;ecs_dev&quot; {
    compute_platform = &quot;ECS&quot;
    name             = &quot;code-deploy-ecs-${local.env}&quot;
  }
  
  resource &quot;aws_codedeploy_deployment_group&quot; &quot;ecs_dev&quot; {
    app_name               = aws_codedeploy_app.ecs_dev.name
    deployment_config_name = &quot;CodeDeployDefault.ECSAllAtOnce&quot;
    deployment_group_name  = &quot;ecs-dev&quot;
    service_role_arn       = aws_iam_role.code_deploy_ecs.arn
  
    auto_rollback_configuration {
      enabled = true
      events  = [&quot;DEPLOYMENT_FAILURE&quot;]
    }
  
    deployment_style {
      deployment_option = &quot;WITH_TRAFFIC_CONTROL&quot;
      deployment_type   = &quot;BLUE_GREEN&quot;
    }
  
    blue_green_deployment_config {
  
      deployment_ready_option {
        action_on_timeout = &quot;CONTINUE_DEPLOYMENT&quot;
      }
  
      terminate_blue_instances_on_deployment_success {
        action                           = &quot;TERMINATE&quot;
        termination_wait_time_in_minutes = 10
      }
  
    }
  
    ecs_service {
      cluster_name = &quot;cluster-name&quot;
      service_name = &quot;ecs-dev&quot;
    }
  
    load_balancer_info {
      target_group_pair_info {
  
        prod_traffic_route {
          listener_arns = &quot;listener_arn&quot; # created from aws console
        }
  
        # green
        target_group {
          name = &quot;green-target-group&quot; # created from aws console
        }
  
        # blue
        target_group {
          name = aws_lb_target_group.blue.name
        }
      }
    }
  }
  
  resource &quot;aws_lb_target_group&quot; &quot;blue&quot; {
    name        = &quot;blue-target-group&quot;
    port        = 80
    protocol    = &quot;HTTP&quot;
    vpc_id      = &quot;ecs-vpc&quot;
    target_type = &quot;instance&quot;
  
    health_check {
      interval            = 30
      timeout             = 5
      healthy_threshold   = 5
      unhealthy_threshold = 2
      protocol            = &quot;HTTP&quot;
      port                = &quot;traffic-port&quot;
      path                = each.value.health_check_path
    }
  }
  </code></pre>
  <p>When I successfully configured CodeDeploy itself and deployed a new task in ECS, the following error occurred.</p>
  <pre><code>The ELB could not be updated due to the following error: Primary taskset target group is not behind any rule for listener
  </code></pre>
  <p>What this means is not clear to me.
  If there is any other information you would like to know, I will provide it.</p>
  <p>Thank you for your time.</p>