fix(docdb): accept an existing security group on CreateDBCluster and ModifyDBCluster (#2991)

* fix(docdb): accept an existing security group on CreateDBCluster and ModifyDBCluster

The security group lookup passed null for group names, which
Ec2Service.describeSecurityGroups does not accept, so any existing group
id answered an internal error while a made-up one was refused correctly
before that filter ran.

Closes #2990

* test(docdb): clean up the EC2 fixtures of the security-group bats case

* test(docdb): tear down the security-group case's EC2 fixtures even when it fails

* test(docdb): delete the case's VPC even when its security group was never created
This commit is contained in:
Michal Schreiber authored and GitHub committed 2026-09-04 10:33:20 -04:00
1 parent 352d89ff2d
commit 91d7ab8935
3 files changed
+65 -2

No files matched your search

@@ -325,7 +325,7 @@ public class DocDbService {
throw new IllegalStateException("DocDbService was built without an Ec2Service");
}
for (String groupId : securityGroups) {
boolean known = ec2Service.describeSecurityGroups(region, List.of(groupId), null, Map.of())
boolean known = ec2Service.describeSecurityGroups(region, List.of(groupId), List.of(), Map.of())
.stream().anyMatch(sg -> groupId.equals(sg.getGroupId()));
if (!known) {
throw new AwsException("InvalidParameterValue",