fix(ec2): report missing network interface security groups (#6582)

Preserve standalone ENI validation before address allocation and the existing ECS network error translation. Keep RunInstances and cross-VPC errors unchanged.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
Andre Kurait authored and GitHub committed 2026-10-26 06:29:37 -04:00
1 parent 4ab43eeeab
commit 42314fcd4e
4 files changed
+98 -2

No files matched your search

@@ -13875,7 +13875,9 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider, Resettab
List<GroupIdentifier> sgIdentifiers = new ArrayList<>();
if (securityGroupIds != null && !securityGroupIds.isEmpty()) {
for (String sgId : securityGroupIds) {
SecurityGroup sg = getRequiredSecurityGroup(region, sgId);
SecurityGroup sg = securityGroups.get(key(region, sgId)).orElseThrow(() ->
new AwsException("InvalidSecurityGroupID.NotFound",
"The securityGroup ID '" + sgId + "' does not exist", 400));
if (!subnet.getVpcId().equals(sg.getVpcId())) {
throw new AwsException("InvalidGroup.NotFound",
"Security group " + sgId + " does not belong to the subnet VPC", 400);
@@ -109,7 +109,7 @@ public class EcsContainerManager {
/** EC2 error codes the task ENI path can raise, none of which RunTask declares. */
private static final Set<String> EC2_NETWORK_LOOKUP_FAILURES =
Set.of("InvalidSubnetID.NotFound", "InvalidGroup.NotFound");
Set.of("InvalidSubnetID.NotFound", "InvalidGroup.NotFound", "InvalidSecurityGroupID.NotFound");
/** How long a container waits for a dependency that has to COMPLETE, SUCCEED or get HEALTHY. */
private static final int DEPENDENCY_WAIT_SECONDS = 60;
private static final long DEPENDENCY_POLL_MILLIS = 200;