Correct way to handle 'optional' array of resources in Terraform
Could you wrap the assignment to value using the try type conversion function?

output primary_LB_Subnet {
  value = try(aws_subnet.subnet_loadbalancer[0], null)
}