From 02e79b9e52eeea4e33deaacbd09bb6e65e8504ca Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Sat, 27 Feb 2016 11:59:09 -0500 Subject: [PATCH] AWS: If we have no subnets, bail out early We know the ELB call will fail, so we error out early rather than hitting the API. Preserves rate limit quota, and also allows us to give a more self-evident message. Fix #21993 --- pkg/cloudprovider/providers/aws/aws.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index dbf171e4248..5ba3091486a 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -2149,6 +2149,11 @@ func (s *AWSCloud) EnsureLoadBalancer(name, region string, publicIP net.IP, port return nil, err } + // Bail out early if there are no subnets + if len(subnetIDs) == 0 { + return nil, fmt.Errorf("could not find any suitable subnets for creating the ELB") + } + // Create a security group for the load balancer var securityGroupID string {