mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(rds): check that a DB instance's security groups exist and sit in its VPC (#8258)
CreateDBInstance and ModifyDBInstance now check that every security group a request names exists in the caller's account and Region and sits in the instance's VPC, refusing an unknown id with InvalidParameterValue and a group of another VPC with InvalidParameterCombination. Restores, read replicas, Blue/Green deployments and CloudFormation go through the same check, and DocumentDB shares it. An instance whose request names no groups gets its VPC's default security group, as RDS documents, and describe reports that group for an instance that keeps none.
This commit is contained in:
1 parent
d1acc664ed
commit
93da7a6c26
15 files changed
+648
-94
No files matched your search
+22
-13
@@ -438,17 +438,22 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
boolean created = instance == null;
|
||||
String caCertificate = resolveOptional(props, "CACertificateIdentifier", engine);
|
||||
DbInstanceInPlaceState stateBefore = created ? null : DbInstanceInPlaceState.of(instance);
|
||||
// Worked out before anything changes, so that nothing can fail between the changes a
|
||||
// rollback cannot undo and the groups, which it can.
|
||||
String subnetGroupName = resolveOptional(props, "DBSubnetGroupName", engine);
|
||||
// Worked out and checked against the VPC the update leaves the instance in before anything
|
||||
// changes, so that nothing can fail between the changes a rollback cannot undo and the groups,
|
||||
// which it can.
|
||||
List<String> desiredGroups = created ? null
|
||||
: desiredVpcSecurityGroups(vpcSecurityGroups, clusterMember, id, ctx);
|
||||
: desiredVpcSecurityGroups(vpcSecurityGroups, clusterMember, id, subnetGroupName, ctx);
|
||||
if (desiredGroups != null) {
|
||||
rdsService.requireVpcSecurityGroupsFit(ctx.region(), id, subnetGroupName, desiredGroups);
|
||||
}
|
||||
if (instance != null) {
|
||||
// A null region keeps the default-region lookup sameNameExistingResource made.
|
||||
instance = rdsService.modifyDbInstance(
|
||||
id,
|
||||
resolveDynamicReferences(resolveOptionalWithoutDynamicReferences(props, "MasterUserPassword", engine), region, true),
|
||||
parseBoolProp(props, "EnableIAMDatabaseAuthentication", engine),
|
||||
resolveOptional(props, "DBSubnetGroupName", engine), null, null, null, null,
|
||||
subnetGroupName, null, null, null, null,
|
||||
DbInstanceSettings.unchanged().withCaCertificateIdentifier(caCertificate));
|
||||
} else {
|
||||
instance = rdsService.createDbInstance(
|
||||
@@ -462,7 +467,7 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
parseIntProp(props, "AllocatedStorage", engine, 20),
|
||||
parseBoolProp(props, "EnableIAMDatabaseAuthentication", engine),
|
||||
resolveOptional(props, "DBParameterGroupName", engine),
|
||||
resolveOptional(props, "DBSubnetGroupName", engine),
|
||||
subnetGroupName,
|
||||
resolveOptional(props, "DBClusterIdentifier", engine),
|
||||
null, false, false, null, Map.of(), vpcSecurityGroups, null, region, true,
|
||||
new DbInstanceSettings(storageEncrypted, null, null, null, null, null)
|
||||
@@ -510,13 +515,14 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
* changes a member's list fails the update, as on AWS, where the handler sends the change to
|
||||
* ModifyDBInstance and RDS refuses it for a member. The change is read from the template, as
|
||||
* there, so a member a stack created before Floci applied the list still takes it. A list the
|
||||
* previous template declared and this one drops puts a standalone instance on its VPC's default
|
||||
* security group, as AWS's handler does, and leaves them when there is no such group, as there; a
|
||||
* previous template declared and this one drops puts a standalone instance on the default security
|
||||
* group of the VPC {@code subnetGroupName} leaves it in, as AWS's handler does, and leaves them
|
||||
* when there is no such group, as there; a
|
||||
* cluster member keeps its groups, as there too. A list the stack never declared leaves groups set
|
||||
* outside it alone.
|
||||
*/
|
||||
private List<String> desiredVpcSecurityGroups(List<String> declared, String clusterMember, String id,
|
||||
ProvisionContext ctx) {
|
||||
String subnetGroupName, ProvisionContext ctx) {
|
||||
boolean member = clusterMember != null && !clusterMember.isBlank();
|
||||
if (!declared.isEmpty()) {
|
||||
if (member && ctx.priorProperties() != null && !Set.copyOf(declared).equals(
|
||||
@@ -529,7 +535,7 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
if (!ctx.previouslyDeclared("VPCSecurityGroups") || member) {
|
||||
return null;
|
||||
}
|
||||
List<String> defaultGroup = rdsService.defaultVpcSecurityGroupIds(ctx.region(), id);
|
||||
List<String> defaultGroup = rdsService.defaultVpcSecurityGroupIds(ctx.region(), id, subnetGroupName);
|
||||
return defaultGroup.isEmpty() ? null : defaultGroup;
|
||||
}
|
||||
|
||||
@@ -538,7 +544,8 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
* when an earlier step fails, the engine restores the resource without calling
|
||||
* {@link #rollbackUpdate}, so only a change made after every other one can be put back there.
|
||||
* What the instance had is saved first, with whether the update changed anything else, for
|
||||
* {@link #rollbackUpdate}.
|
||||
* {@link #rollbackUpdate}, except the groups of an instance the update moved to another VPC: a
|
||||
* rollback does not move it back, and the old VPC's groups cannot go on it in the new one.
|
||||
*/
|
||||
private void reconcileInstanceSecurityGroups(StackResource r, DbInstance instance, List<String> desired,
|
||||
DbInstanceInPlaceState stateBefore, ProvisionContext ctx) {
|
||||
@@ -546,7 +553,7 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
List<String> groupsBefore = stateBefore.vpcSecurityGroups();
|
||||
boolean groupsChange = desired != null && !Set.copyOf(desired).equals(Set.copyOf(groupsBefore));
|
||||
ObjectNode saved = MAPPER.createObjectNode().put("region", ctx.region());
|
||||
if (groupsChange) {
|
||||
if (groupsChange && Objects.equals(stateBefore.vpcId(), instance.getVpcId())) {
|
||||
ArrayNode priorGroups = saved.putArray("vpcSecurityGroups");
|
||||
groupsBefore.forEach(priorGroups::add);
|
||||
}
|
||||
@@ -563,7 +570,8 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
* changes do not reach them. Only the groups have a rollback here.
|
||||
*/
|
||||
private record DbInstanceInPlaceState(String masterPassword, boolean iamAuthentication, String subnetGroup,
|
||||
String caCertificate, Set<String> roles, List<String> vpcSecurityGroups) {
|
||||
String vpcId, String caCertificate, Set<String> roles,
|
||||
List<String> vpcSecurityGroups) {
|
||||
|
||||
static DbInstanceInPlaceState of(DbInstance instance) {
|
||||
Set<String> roles = new HashSet<>();
|
||||
@@ -572,7 +580,8 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
}
|
||||
return new DbInstanceInPlaceState(instance.getMasterPassword(),
|
||||
instance.isIamDatabaseAuthenticationEnabled(), instance.getDbSubnetGroupName(),
|
||||
instance.getCaCertificateIdentifier(), roles, List.copyOf(instance.getVpcSecurityGroupIds()));
|
||||
instance.getVpcId(), instance.getCaCertificateIdentifier(), roles,
|
||||
List.copyOf(instance.getVpcSecurityGroupIds()));
|
||||
}
|
||||
|
||||
/** Whether {@code other} has the same settings and roles, whatever its groups. */
|
||||
|
||||
@@ -18,6 +18,7 @@ import io.floci.aws.services.docdb.model.DocDbInstanceSettings;
|
||||
import io.floci.aws.services.ec2.Ec2Service;
|
||||
import io.floci.aws.services.kms.KmsService;
|
||||
import io.floci.aws.services.kms.model.KmsKey;
|
||||
import io.floci.aws.services.rds.RdsSecurityGroups;
|
||||
import io.floci.aws.services.rds.RdsService;
|
||||
import io.floci.aws.services.rds.model.DbClusterParameterGroup;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
@@ -334,14 +335,7 @@ public class DocDbService {
|
||||
if (ec2Service == null) {
|
||||
throw new IllegalStateException("DocDbService was built without an Ec2Service");
|
||||
}
|
||||
for (String groupId : securityGroups) {
|
||||
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",
|
||||
"Invalid security group , groupId= " + groupId + ", groupName=.", 400);
|
||||
}
|
||||
}
|
||||
RdsSecurityGroups.requireInVpc(ec2Service, region, securityGroups, null);
|
||||
} else if (create) {
|
||||
securityGroups = List.of(Ec2Service.defaultSecurityGroupId(region));
|
||||
}
|
||||
|
||||
@@ -3473,9 +3473,13 @@ public class RdsQueryHandler {
|
||||
}
|
||||
|
||||
private String vpcSecurityGroupsXml(DbInstance i) {
|
||||
List<String> groupIds = i.getVpcSecurityGroupIds().isEmpty()
|
||||
? List.of("sg-00000000")
|
||||
: i.getVpcSecurityGroupIds();
|
||||
List<String> groupIds = i.getVpcSecurityGroupIds();
|
||||
if (groupIds.isEmpty()) {
|
||||
groupIds = service.defaultVpcSecurityGroupIds(i);
|
||||
}
|
||||
if (groupIds.isEmpty()) {
|
||||
groupIds = List.of("sg-00000000");
|
||||
}
|
||||
XmlBuilder xml = new XmlBuilder().start("VpcSecurityGroups");
|
||||
for (String groupId : groupIds) {
|
||||
xml.start("VpcSecurityGroupMembership")
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package io.floci.aws.services.rds;
|
||||
|
||||
import io.floci.aws.core.common.AwsException;
|
||||
import io.floci.aws.services.ec2.Ec2Service;
|
||||
import io.floci.aws.services.ec2.model.SecurityGroup;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The checks the RDS API makes on the VPC security group ids a request names, shared with DocumentDB,
|
||||
* which serves the same API: each id names a security group of the caller's account and Region, and
|
||||
* every group sits in the resource's VPC. When a request names none, RDS puts a DB instance on its
|
||||
* VPC's default security group.
|
||||
*/
|
||||
public final class RdsSecurityGroups {
|
||||
|
||||
private RdsSecurityGroups() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses {@code groupIds} unless each names a security group of {@code region} and, when
|
||||
* {@code vpcId} is given, every one of them is in that VPC. A null or empty list names no groups
|
||||
* and passes.
|
||||
*/
|
||||
public static void requireInVpc(Ec2Service ec2Service, String region, List<String> groupIds, String vpcId) {
|
||||
if (groupIds == null || groupIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<String, SecurityGroup> found = new LinkedHashMap<>();
|
||||
for (SecurityGroup group : ec2Service.describeSecurityGroups(region, groupIds, List.of(), Map.of())) {
|
||||
found.put(group.getGroupId(), group);
|
||||
}
|
||||
List<String> unknown = groupIds.stream().filter(id -> !found.containsKey(id)).distinct().toList();
|
||||
if (!unknown.isEmpty()) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Invalid security group , groupId= " + String.join(", ", unknown) + ", groupName=.", 400);
|
||||
}
|
||||
if (vpcId == null) {
|
||||
return;
|
||||
}
|
||||
for (String groupId : groupIds) {
|
||||
String groupVpcId = found.get(groupId).getVpcId();
|
||||
if (!vpcId.equals(groupVpcId)) {
|
||||
throw new AwsException("InvalidParameterCombination",
|
||||
"The DB instance and EC2 security group are in different VPCs. The DB instance is in "
|
||||
+ vpcId + " and the EC2 security group is in " + groupVpcId, 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** {@code groupIds}, or when they name no group, the default security group of {@code vpcId}. */
|
||||
public static List<String> orVpcDefault(Ec2Service ec2Service, String region, List<String> groupIds,
|
||||
String vpcId) {
|
||||
return groupIds == null || groupIds.isEmpty() ? vpcDefault(ec2Service, region, vpcId) : groupIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default security group of {@code vpcId}, or no group when there is no VPC or EC2 has no
|
||||
* default group for it.
|
||||
*/
|
||||
public static List<String> vpcDefault(Ec2Service ec2Service, String region, String vpcId) {
|
||||
if (vpcId == null || vpcId.isBlank()) {
|
||||
return List.of();
|
||||
}
|
||||
return ec2Service.defaultSecurityGroupOf(region, vpcId).map(group -> List.of(group.getGroupId()))
|
||||
.orElse(List.of());
|
||||
}
|
||||
}
|
||||
@@ -856,6 +856,18 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<String> instanceSecurityGroupIds;
|
||||
try {
|
||||
RdsSecurityGroups.requireInVpc(ec2Service, effectiveRegion, vpcSecurityGroupIds, placement.vpcId());
|
||||
// A cluster member's groups are its cluster's.
|
||||
instanceSecurityGroupIds = isBlank(dbClusterIdentifier)
|
||||
? RdsSecurityGroups.orVpcDefault(ec2Service, effectiveRegion, vpcSecurityGroupIds,
|
||||
placement.vpcId())
|
||||
: vpcSecurityGroupIds;
|
||||
} catch (RuntimeException | Error failure) {
|
||||
releaseProxyPort(proxyPort);
|
||||
throw failure;
|
||||
}
|
||||
|
||||
DbEndpoint endpoint;
|
||||
DbInstance instance;
|
||||
@@ -873,7 +885,7 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
instance.setDockerVolumeName(instanceDockerVolumeName);
|
||||
instance.setContainerStorageResourceId(instanceStorageResourceId);
|
||||
instance.setTags(tags);
|
||||
instance.setVpcSecurityGroupIds(vpcSecurityGroupIds);
|
||||
instance.setVpcSecurityGroupIds(instanceSecurityGroupIds);
|
||||
instance.setDbSubnetGroupName(placement.dbSubnetGroupName());
|
||||
instance.setVpcId(placement.vpcId());
|
||||
instance.setAvailabilityZone(placement.availabilityZone());
|
||||
@@ -2210,9 +2222,13 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
request.optionGroupName(), sameRegion ? source.getOptionGroupName() : null);
|
||||
String dbSubnetGroupName = firstNonBlank(
|
||||
request.dbSubnetGroupName(), sameRegion ? source.getDbSubnetGroupName() : null);
|
||||
// The source's groups belong to its VPC, so a replica placed in another one gets that VPC's
|
||||
// default group instead.
|
||||
boolean inSourceVpc = sameRegion && (isBlank(request.dbSubnetGroupName()) || Objects.equals(
|
||||
getDbSubnetGroup(request.dbSubnetGroupName(), effectiveRegion).getVpcId(), source.getVpcId()));
|
||||
List<String> vpcSecurityGroupIds = request.vpcSecurityGroupIds() != null
|
||||
? request.vpcSecurityGroupIds()
|
||||
: sameRegion ? source.getVpcSecurityGroupIds() : List.of();
|
||||
: inSourceVpc ? source.getVpcSecurityGroupIds() : List.of();
|
||||
boolean autoMinorVersionUpgrade = request.autoMinorVersionUpgrade() != null
|
||||
? request.autoMinorVersionUpgrade() : source.isAutoMinorVersionUpgrade();
|
||||
// Backups stay off on a replica; the source's windows carry over, and encryption follows
|
||||
@@ -3912,6 +3928,16 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
validateInstanceParameterGroup(dbParameterGroupName, engineName(instance),
|
||||
instance.getEngineVersion(), effectiveRegion);
|
||||
}
|
||||
// A new subnet group can move the instance to another VPC, so the groups are checked against that VPC.
|
||||
DbSubnetGroup newSubnetGroup = isBlank(dbSubnetGroupName)
|
||||
? null : getDbSubnetGroup(dbSubnetGroupName, effectiveRegion);
|
||||
String vpcIdAfter = newSubnetGroup != null ? newSubnetGroup.getVpcId() : instance.getVpcId();
|
||||
RdsSecurityGroups.requireInVpc(ec2Service, effectiveRegion, vpcSecurityGroupIds, vpcIdAfter);
|
||||
// The old VPC's groups cannot follow the instance to another one, so it gets the groups the request
|
||||
// names or that VPC's default group. Null keeps the groups it has.
|
||||
List<String> securityGroupIdsAfter = !Objects.equals(vpcIdAfter, instance.getVpcId())
|
||||
? RdsSecurityGroups.orVpcDefault(ec2Service, effectiveRegion, vpcSecurityGroupIds, vpcIdAfter)
|
||||
: vpcSecurityGroupIds == null || vpcSecurityGroupIds.isEmpty() ? null : vpcSecurityGroupIds;
|
||||
instance.setStatus(DbInstanceStatus.AVAILABLE);
|
||||
if (changesParameterGroup) {
|
||||
instance.setParameterGroupName(dbParameterGroupName);
|
||||
@@ -3947,12 +3973,12 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
if (iamEnabled != null) {
|
||||
instance.setIamDatabaseAuthenticationEnabled(iamEnabled);
|
||||
}
|
||||
if (dbSubnetGroupName != null && !dbSubnetGroupName.isBlank()) {
|
||||
getDbSubnetGroup(dbSubnetGroupName, effectiveRegion);
|
||||
if (newSubnetGroup != null) {
|
||||
instance.setDbSubnetGroupName(dbSubnetGroupName);
|
||||
instance.setVpcId(newSubnetGroup.getVpcId());
|
||||
}
|
||||
if (vpcSecurityGroupIds != null && !vpcSecurityGroupIds.isEmpty()) {
|
||||
instance.setVpcSecurityGroupIds(vpcSecurityGroupIds);
|
||||
if (securityGroupIdsAfter != null) {
|
||||
instance.setVpcSecurityGroupIds(securityGroupIdsAfter);
|
||||
}
|
||||
if (autoMinorVersionUpgrade != null) {
|
||||
instance.setAutoMinorVersionUpgrade(autoMinorVersionUpgrade);
|
||||
@@ -4068,6 +4094,7 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
DbInstance instance = getDbInstance(instanceId, effectiveRegion);
|
||||
requireAvailableInstance(instance, instanceId);
|
||||
RdsSecurityGroups.requireInVpc(ec2Service, effectiveRegion, groupIds, instance.getVpcId());
|
||||
instance.setVpcSecurityGroupIds(groupIds);
|
||||
putInstanceForScope(currentAccountId(), effectiveRegion, instanceId, instance);
|
||||
LOG.infov("DB instance {0} security groups set to {1}", instanceId, groupIds);
|
||||
@@ -4075,19 +4102,50 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* The groups AWS's CloudFormation handler gives a standalone DB instance whose template stops
|
||||
* declaring {@code VPCSecurityGroups}: the default security group of its VPC, or none when EC2
|
||||
* has no default group for it.
|
||||
* The default security group of {@code instance}'s VPC, which describe reports for an instance that
|
||||
* keeps no groups: an Aurora member, whose groups are its cluster's, or one stored before RDS gave
|
||||
* one. No group when its VPC is unknown or gone.
|
||||
*/
|
||||
public List<String> defaultVpcSecurityGroupIds(String region, String instanceId) {
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
String vpcId = getDbInstance(instanceId, effectiveRegion).getVpcId();
|
||||
if (isBlank(vpcId)) {
|
||||
public List<String> defaultVpcSecurityGroupIds(DbInstance instance) {
|
||||
try {
|
||||
return RdsSecurityGroups.vpcDefault(ec2Service, regionFromArn(instance.getDbInstanceArn()),
|
||||
instance.getVpcId());
|
||||
} catch (AwsException e) {
|
||||
LOG.debugv("No default security group to report for DB instance {0} in {1}: {2}",
|
||||
instance.getDbInstanceIdentifier(), instance.getVpcId(), e.getMessage());
|
||||
return List.of();
|
||||
}
|
||||
return ec2Service.defaultSecurityGroupOf(effectiveRegion, vpcId)
|
||||
.map(group -> List.of(group.getGroupId()))
|
||||
.orElse(List.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* The groups AWS's CloudFormation handler gives a standalone DB instance whose template stops
|
||||
* declaring {@code VPCSecurityGroups}: the default security group of the VPC it is in once
|
||||
* {@code dbSubnetGroupName}, when given, is its subnet group, or none when EC2 has no default group
|
||||
* for it.
|
||||
*/
|
||||
public List<String> defaultVpcSecurityGroupIds(String region, String instanceId, String dbSubnetGroupName) {
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
return RdsSecurityGroups.vpcDefault(ec2Service, effectiveRegion,
|
||||
vpcIdAfter(instanceId, dbSubnetGroupName, effectiveRegion));
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses {@code groupIds} as {@code ModifyDBInstance} would for instance {@code instanceId} given
|
||||
* {@code dbSubnetGroupName}, for CloudFormation, which changes the subnet group and the groups in
|
||||
* separate steps and so checks the groups before the first one.
|
||||
*/
|
||||
public void requireVpcSecurityGroupsFit(String region, String instanceId, String dbSubnetGroupName,
|
||||
List<String> groupIds) {
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
RdsSecurityGroups.requireInVpc(ec2Service, effectiveRegion, groupIds,
|
||||
vpcIdAfter(instanceId, dbSubnetGroupName, effectiveRegion));
|
||||
}
|
||||
|
||||
/** The VPC instance {@code instanceId} is in once {@code dbSubnetGroupName}, when given, is its subnet group. */
|
||||
private String vpcIdAfter(String instanceId, String dbSubnetGroupName, String effectiveRegion) {
|
||||
return isBlank(dbSubnetGroupName)
|
||||
? getDbInstance(instanceId, effectiveRegion).getVpcId()
|
||||
: getDbSubnetGroup(dbSubnetGroupName, effectiveRegion).getVpcId();
|
||||
}
|
||||
|
||||
private static void validateInstanceSettings(DbInstanceSettings settings) {
|
||||
@@ -7744,10 +7802,8 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
endpoint.setStatus("available");
|
||||
endpoint.setVpcId(vpcId);
|
||||
endpoint.setVpcSubnetIds(vpcSubnetIds);
|
||||
endpoint.setVpcSecurityGroupIds(vpcSecurityGroupIds == null || vpcSecurityGroupIds.isEmpty()
|
||||
? ec2Service.defaultSecurityGroupOf(effectiveRegion, vpcId).map(sg -> List.of(sg.getGroupId()))
|
||||
.orElse(List.of())
|
||||
: vpcSecurityGroupIds);
|
||||
endpoint.setVpcSecurityGroupIds(
|
||||
RdsSecurityGroups.orVpcDefault(ec2Service, effectiveRegion, vpcSecurityGroupIds, vpcId));
|
||||
endpoint.setCreatedDate(Instant.now());
|
||||
endpoint.setTargetRole(role);
|
||||
endpoint.setEndpointNetworkType(networkType);
|
||||
|
||||
Reference in new issue
Block a user