Title: Message Title
David Fluck commented on JENKINS-35708
Re: EC2 Plugin: Ability to round robin EC2 availability zones
It looks like this change has indeed been released. I've also encountered that error before. How are you listing the subnets? Are you using subnet IDs? Are all of the subnets in the same VPC? This is the relevant code:
private List getEc2SecurityGroups(AmazonEC2 ec2) throws AmazonClientException {
List groupIds = new ArrayList();
DescribeSecurityGroupsResult groupResult = getSecurityGroupsBy("group-name", securityGroupSet, ec2);
if (groupResult.getSecurityGroups().size() == 0) {
groupResult = getSecurityGroupsBy("group-id", securityGroupSet, ec2);
}
for (SecurityGroup group : groupResult.getSecurityGroups()) {
if (group.getVpcId() != null && !group.getVpcId().isEmpty()) {
List filters = new ArrayList();
filters.add(new Filter("vpc-id").withValues(group.getVpcId()));
filters.add(new Filter("state").withValues("available"));
filters.add(new Filter("subnet-id").withValues(getCurrentSubnetId()));
DescribeSubnetsRequest subnetReq = new DescribeSubnetsRequest();
subnetReq.withFilters(filters);
DescribeSubnetsResult subnetResult = ec2.describeSubnets(subnetReq);
List subnets = subnetResult.getSubnets();
if (subnets != null && !subnets.isEmpty()) {
groupIds.add(group.getGroupId());
}
}
}
if (securityGroupSet.size() != groupIds.size()) {
throw new AmazonClientException("Security groups must all be VPC security groups to work in a VPC context");
}
return groupIds;
}
Add Comment
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)