feat(redshift): manage master password with secrets manager (#3871)

* feat(redshift): manage master password with secrets manager

* fix(redshift): align managed password contract

* fix(redshift): expose managed password secret arn
This commit is contained in:
Vũ Thế Huy authored and GitHub committed 2026-09-18 13:55:13 -04:00
1 parent 004d562f34
commit 023af51627
9 files changed
+236 -23

No files matched your search

+6 -1
View File
@@ -70,7 +70,9 @@ For `AWS::Redshift::ClusterParameterGroup`, `Parameters` is applied via `ModifyC
- `Port` is ignored: Floci assigns the dynamic host proxy port returned in `Endpoint.Port`.
- `DBName` other than `dev` is ignored: the emulated PostgreSQL container database is always `dev`.
- `NumberOfNodes` is not stored on cluster create: every emulated cluster is backed by a single PostgreSQL container.
- `ManageMasterPassword` is rejected: set `MasterUserPassword` instead.
- `ManageMasterPassword` creates a Redshift-owned Secrets Manager secret. The secret contains the
managed username, password, endpoint, port, and database name. `MasterPasswordSecretKmsKeyId`
selects the KMS key used for the secret metadata and is validated through KMS.
- `SnapshotIdentifier` is ignored: a fresh cluster is created instead of restoring from a snapshot.
- `AWS::Redshift::ClusterSecurityGroup` is accepted as metadata: Floci does not emulate the legacy EC2-Classic security group model.
@@ -296,4 +298,7 @@ These views expose the documented Redshift column names, types, and ordering map
- Resize, pause/resume, IAM authentication, snapshot schedules, and cross-region snapshot copy.
- `IAM_ROLE default` and cross-account role ARNs are not supported for COPY or UNLOAD.
- The auth proxy validates the master user's password and any live `GetClusterCredentials` credential. Other non-master users pass straight through to PostgreSQL, which remains the authority for their credentials.
- A cluster using `ManageMasterPassword` keeps its generated password in sync with the
Redshift-owned Secrets Manager secret. Updating `MasterUserPassword` through `ModifyCluster`
updates the current secret version as well.
- IAM database authentication over the wire, and `sslmode=verify-full` against the self-signed proxy certificate.
@@ -95,14 +95,11 @@ public class RedshiftClusterCfnProvisioner implements CfnResourceProvisioner {
private void provisionCluster(StackResource r, JsonNode props, ProvisionContext ctx,
Map<String, String> attributesBefore) {
if (Boolean.parseBoolean(ctx.resolveOptional(props, "ManageMasterPassword"))) {
throw new AwsException("ValidationException",
"ManageMasterPassword is not emulated by Floci; set MasterUserPassword instead", 400);
}
boolean manageMasterPassword = Boolean.parseBoolean(ctx.resolveOptional(props, "ManageMasterPassword"));
String nodeType = ctx.resolveOptional(props, "NodeType");
String masterUsername = ctx.resolveOptional(props, "MasterUsername");
String masterUserPassword = ctx.resolveOptional(props, "MasterUserPassword");
if (masterUserPassword == null || masterUserPassword.isBlank()) {
if (!manageMasterPassword && (masterUserPassword == null || masterUserPassword.isBlank())) {
throw new AwsException("ValidationException",
"MasterUserPassword is required unless ManageMasterPassword is set", 400);
}
@@ -135,12 +132,19 @@ public class RedshiftClusterCfnProvisioner implements CfnResourceProvisioner {
// provision() is the update path too. A same-id cluster already on file is reconciled;
// a derived id that differs from the prior physical id is a replacement handled via ReplacementCleanup.
Cluster cluster = ctx.reusesPriorEntity(id)
? redshiftService.modifyCluster(id, nodeType, numberOfNodes(props, ctx),
masterUserPassword, ctx.resolveOptional(props, "ClusterParameterGroupName"),
securityGroups)
: redshiftService.createCluster(id, nodeType, masterUsername, masterUserPassword,
subnetGroup, securityGroups);
Cluster cluster;
if (ctx.reusesPriorEntity(id)) {
cluster = redshiftService.modifyCluster(id, nodeType, numberOfNodes(props, ctx),
masterUserPassword, ctx.resolveOptional(props, "ClusterParameterGroupName"),
securityGroups);
} else if (manageMasterPassword) {
String kmsKeyId = props.path("MasterPasswordSecretKmsKeyId").asText(null);
cluster = redshiftService.createClusterWithManagedMasterPassword(id, nodeType, masterUsername,
subnetGroup, securityGroups, List.of(), kmsKeyId, ctx.region());
} else {
cluster = redshiftService.createCluster(id, nodeType, masterUsername, masterUserPassword,
subnetGroup, securityGroups);
}
Map<String, String> tags = ctx.resolveTags(props, "Tags");
if (!tags.isEmpty()) {
@@ -155,6 +159,9 @@ public class RedshiftClusterCfnProvisioner implements CfnResourceProvisioner {
r.getAttributes().put("Endpoint.Address", cluster.getEndpoint().getAddress());
r.getAttributes().put("Endpoint.Port", String.valueOf(cluster.getEndpoint().getPort()));
}
if (cluster.getMasterPasswordSecretArn() != null) {
r.getAttributes().put("MasterPasswordSecretArn", cluster.getMasterPasswordSecretArn());
}
r.getAttributes().put("ClusterNamespaceArn", namespaceArn(ctx, id));
}
@@ -65,11 +65,17 @@ public class RedshiftQueryHandler {
String nodeType = params.getFirst("NodeType");
String masterUsername = params.getFirst("MasterUsername");
String masterUserPassword = params.getFirst("MasterUserPassword");
boolean manageMasterPassword = Boolean.parseBoolean(params.getFirst("ManageMasterPassword"));
String clusterSubnetGroupName = params.getFirst("ClusterSubnetGroupName");
List<String> vpcSecurityGroupIds = memberList(params, "VpcSecurityGroupIds");
List<String> iamRoleArns = memberList(params, "IamRoles");
Cluster cluster = iamRoleArns.isEmpty()
String region = regionResolver.resolveRegionFromAuth(authorizationHeader);
Cluster cluster = manageMasterPassword
? service.createClusterWithManagedMasterPassword(identifier, nodeType, masterUsername,
clusterSubnetGroupName, vpcSecurityGroupIds, iamRoleArns,
params.getFirst("MasterPasswordSecretKmsKeyId"), region)
: iamRoleArns.isEmpty()
? service.createCluster(identifier, nodeType, masterUsername, masterUserPassword,
clusterSubnetGroupName, vpcSecurityGroupIds)
: service.createCluster(identifier, nodeType, masterUsername, masterUserPassword,
@@ -618,6 +624,11 @@ public class RedshiftQueryHandler {
.elem("AvailabilityZoneRelocationStatus", "disabled")
.elem("ClusterSubnetGroupName", cluster.getClusterSubnetGroupName());
if (cluster.getMasterPasswordSecretArn() != null) {
builder.elem("MasterPasswordSecretArn", cluster.getMasterPasswordSecretArn())
.elem("MasterPasswordSecretKmsKeyId", cluster.getMasterPasswordSecretKmsKeyId());
}
if (cluster.getVpcSecurityGroupIds() != null && !cluster.getVpcSecurityGroupIds().isEmpty()) {
builder.start("VpcSecurityGroups");
for (String sgId : cluster.getVpcSecurityGroupIds()) {
@@ -1,14 +1,14 @@
package io.github.hectorvent.floci.services.redshift;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.docker.DockerHostResolver;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.services.rds.proxy.PasswordValidator;
import io.github.hectorvent.floci.services.redshift.proxy.RedshiftProxyManager;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.rds.proxy.PasswordValidator;
import io.github.hectorvent.floci.services.redshift.container.RedshiftContainerHandle;
import io.github.hectorvent.floci.services.redshift.container.RedshiftContainerManager;
import io.github.hectorvent.floci.services.redshift.model.Integration;
@@ -22,6 +22,10 @@ import io.github.hectorvent.floci.services.redshift.model.ClusterSubnetGroup;
import io.github.hectorvent.floci.services.redshift.model.Endpoint;
import io.github.hectorvent.floci.services.redshift.model.Parameter;
import io.github.hectorvent.floci.services.redshift.model.Snapshot;
import io.github.hectorvent.floci.services.redshift.proxy.RedshiftProxyManager;
import io.github.hectorvent.floci.services.secretsmanager.RandomPasswordGenerator;
import io.github.hectorvent.floci.services.secretsmanager.SecretsManagerService;
import io.github.hectorvent.floci.services.secretsmanager.model.Secret;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
@@ -68,6 +72,8 @@ public class RedshiftService {
private final RedshiftProxyManager proxyManager;
private final DockerHostResolver dockerHostResolver;
private final RedshiftCredentialBroker credentialBroker;
private final SecretsManagerService secretsManagerService;
private final ObjectMapper objectMapper;
// Proxy ports currently handed out, so allocateProxyPort never double-assigns within this JVM.
private final Set<Integer> usedPorts = ConcurrentHashMap.newKeySet();
@@ -75,7 +81,8 @@ public class RedshiftService {
public RedshiftService(StorageFactory storageFactory, RedshiftContainerManager containerManager,
EmulatorConfig config, RegionResolver regionResolver,
RedshiftProxyManager proxyManager, DockerHostResolver dockerHostResolver,
RedshiftCredentialBroker credentialBroker) {
RedshiftCredentialBroker credentialBroker,
SecretsManagerService secretsManagerService, ObjectMapper objectMapper) {
this.clusters = storageFactory.create("redshift", "redshift-clusters.json", new TypeReference<Map<String, Cluster>>() {});
this.snapshots = storageFactory.create("redshift", "redshift-snapshots.json", new TypeReference<Map<String, Snapshot>>() {});
this.parameterGroups = storageFactory.create("redshift", "redshift-parameter-groups.json", new TypeReference<Map<String, ClusterParameterGroup>>() {});
@@ -87,6 +94,16 @@ public class RedshiftService {
this.proxyManager = proxyManager;
this.dockerHostResolver = dockerHostResolver;
this.credentialBroker = credentialBroker;
this.secretsManagerService = secretsManagerService;
this.objectMapper = objectMapper;
}
RedshiftService(StorageFactory storageFactory, RedshiftContainerManager containerManager,
EmulatorConfig config, RegionResolver regionResolver,
RedshiftProxyManager proxyManager, DockerHostResolver dockerHostResolver,
RedshiftCredentialBroker credentialBroker) {
this(storageFactory, containerManager, config, regionResolver, proxyManager, dockerHostResolver,
credentialBroker, null, new ObjectMapper());
}
// Recreate Docker containers for persisted clusters on app restart (across every account, not just default)
@@ -226,6 +243,53 @@ public class RedshiftService {
return cluster;
}
public synchronized Cluster createClusterWithManagedMasterPassword(
String identifier, String nodeType, String username, String clusterSubnetGroupName,
List<String> vpcSecurityGroupIds, List<String> iamRoleArns,
String kmsKeyId, String region) {
if (secretsManagerService == null) {
throw new AwsException("InternalFailure", "Secrets Manager is unavailable", 500);
}
String password = RandomPasswordGenerator.generate(objectMapper.createObjectNode());
Cluster cluster = createCluster(identifier, nodeType, username, password,
clusterSubnetGroupName, vpcSecurityGroupIds, iamRoleArns);
String secretName = "redshift/" + identifier;
String secretString = managedMasterSecret(cluster, password);
Secret secret;
try {
secret = secretsManagerService.createSecret(secretName, secretString, null,
"Managed master user secret for Redshift cluster " + identifier,
kmsKeyId, List.of(), "redshift", region);
} catch (RuntimeException e) {
rollbackManagedMasterPasswordCluster(cluster);
throw e;
}
cluster.setMasterPasswordSecretArn(secret.getArn());
cluster.setMasterPasswordSecretKmsKeyId(kmsKeyId);
clusters.put(identifier, cluster);
clusters.flush();
return cluster;
}
private void rollbackManagedMasterPasswordCluster(Cluster cluster) {
boolean proxyStopped = stopProxyAndReleasePortSafely(
cluster.getClusterIdentifier(), cluster.getProxyPort());
try {
containerManager.stop(clusters.accountId(), cluster.getClusterIdentifier());
} catch (Exception e) {
LOG.warnv(e, "Failed to stop managed-password cluster container {0} during rollback",
cluster.getClusterIdentifier());
}
if (proxyStopped) {
clusters.delete(cluster.getClusterIdentifier());
credentialBroker.revokeCluster(clusters.accountId(), cluster.getClusterIdentifier());
} else {
cluster.setClusterStatus("failed");
clusters.put(cluster.getClusterIdentifier(), cluster);
}
clusters.flush();
}
// ── Zero-ETL integrations ────────────────────────────────────
//
// Metadata only: no data is replicated from the source. The shape and the lower case status
@@ -425,6 +489,15 @@ public class RedshiftService {
// identifier does not accept them as master-equivalent.
credentialBroker.revokeCluster(clusters.accountId(), identifier);
if (cluster.getMasterPasswordSecretArn() != null && secretsManagerService != null) {
try {
secretsManagerService.deleteSecret(cluster.getMasterPasswordSecretArn(), null, true,
regionResolver.getRegion());
} catch (AwsException e) {
LOG.warnv(e, "Failed to remove managed master secret for cluster {0}", identifier);
}
}
cluster.setClusterStatus("deleting");
return cluster;
}
@@ -444,6 +517,7 @@ public class RedshiftService {
// Keep the proxy's password check in sync so new connections use the new secret.
proxyManager.updateMasterPassword(
relayKey(clusters.accountId(), clusterIdentifier), masterUserPassword);
updateManagedMasterSecret(cluster, masterUserPassword);
}
// NodeType only updates metadata — it does not resize the underlying Postgres container
@@ -464,6 +538,30 @@ public class RedshiftService {
return cluster;
}
private void updateManagedMasterSecret(Cluster cluster, String password) {
if (cluster.getMasterPasswordSecretArn() == null || secretsManagerService == null) {
return;
}
secretsManagerService.putSecretValue(cluster.getMasterPasswordSecretArn(),
managedMasterSecret(cluster, password), null, null, regionResolver.getRegion(),
List.of("AWSCURRENT"));
}
private String managedMasterSecret(Cluster cluster, String password) {
try {
return objectMapper.createObjectNode()
.put("engine", "redshift")
.put("username", cluster.getMasterUsername())
.put("password", password)
.put("host", cluster.getEndpoint() == null ? "" : cluster.getEndpoint().getAddress())
.put("port", cluster.getEndpoint() == null ? 0 : cluster.getEndpoint().getPort())
.put("dbname", CLUSTER_DB_NAME)
.toString();
} catch (RuntimeException e) {
throw new AwsException("InternalFailure", "Failed to encode managed master secret", 500);
}
}
public synchronized Cluster rebootCluster(String clusterIdentifier) {
Cluster cluster = clusters.get(clusterIdentifier)
.orElseThrow(() -> new AwsException("ClusterNotFound", "Cluster " + clusterIdentifier + " not found", 404));
@@ -12,6 +12,8 @@ public class Cluster {
private String nodeType;
private String masterUsername;
private String masterPassword;
private String masterPasswordSecretArn;
private String masterPasswordSecretKmsKeyId;
private String clusterStatus;
private Endpoint endpoint;
private String clusterSubnetGroupName;
@@ -27,6 +29,10 @@ public class Cluster {
public void setMasterUsername(String masterUsername) { this.masterUsername = masterUsername; }
public String getMasterPassword() { return masterPassword; }
public void setMasterPassword(String masterPassword) { this.masterPassword = masterPassword; }
public String getMasterPasswordSecretArn() { return masterPasswordSecretArn; }
public void setMasterPasswordSecretArn(String masterPasswordSecretArn) { this.masterPasswordSecretArn = masterPasswordSecretArn; }
public String getMasterPasswordSecretKmsKeyId() { return masterPasswordSecretKmsKeyId; }
public void setMasterPasswordSecretKmsKeyId(String masterPasswordSecretKmsKeyId) { this.masterPasswordSecretKmsKeyId = masterPasswordSecretKmsKeyId; }
public String getClusterStatus() { return clusterStatus; }
public void setClusterStatus(String clusterStatus) { this.clusterStatus = clusterStatus; }
public Endpoint getEndpoint() { return endpoint; }
@@ -362,15 +362,27 @@ class RedshiftClusterCfnProvisionerTest {
}
@Test
void provisionRejectsManageMasterPassword() {
RedshiftClusterCfnProvisioner p = new RedshiftClusterCfnProvisioner(mock(RedshiftService.class));
void provisionSupportsManageMasterPassword() {
RedshiftService service = mock(RedshiftService.class);
when(service.createClusterWithManagedMasterPassword(anyString(), anyString(), anyString(), isNull(),
anyList(), anyList(), any(), anyString())).thenAnswer(inv -> {
Cluster cluster = availableCluster(inv.getArgument(0));
cluster.setMasterPasswordSecretArn("arn:aws:secretsmanager:us-east-1:000000000000:secret:redshift-managed");
return cluster;
});
RedshiftClusterCfnProvisioner p = new RedshiftClusterCfnProvisioner(service);
StackResource r = new StackResource();
r.setResourceType("AWS::Redshift::Cluster");
r.setLogicalId("W");
AwsException ex = assertThrows(AwsException.class, () -> p.provision(r, json("""
{"NodeType":"ra3.large","MasterUsername":"admin","ManageMasterPassword":true}"""), ctx(null)));
assertEquals("ValidationException", ex.getErrorCode());
p.provision(r, json("""
{"NodeType":"ra3.large","MasterUsername":"admin","ManageMasterPassword":true,
"MasterPasswordSecretKmsKeyId":"alias/redshift-key"}"""), ctx(null));
verify(service).createClusterWithManagedMasterPassword(anyString(), eq("ra3.large"), eq("admin"),
isNull(), anyList(), eq(List.of()), eq("alias/redshift-key"), eq("us-east-1"));
assertEquals("arn:aws:secretsmanager:us-east-1:000000000000:secret:redshift-managed",
r.getAttributes().get("MasterPasswordSecretArn"));
}
@Test
@@ -19,6 +19,7 @@ import java.util.List;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -42,6 +43,7 @@ class RedshiftQueryHandlerTest {
iamDbUserResolver = mock(RedshiftIamDbUserResolver.class);
regionResolver = mock(RegionResolver.class);
when(regionResolver.getAccountId()).thenReturn("acc");
when(regionResolver.resolveRegionFromAuth(anyString())).thenReturn("us-east-1");
handler = new RedshiftQueryHandler(service, credentialBroker, config, iamDbUserResolver, regionResolver);
}
@@ -77,6 +79,36 @@ class RedshiftQueryHandlerTest {
assertTrue(xml.contains("<RequestId>test-req-id</RequestId>"));
}
@Test
void createClusterWithManagedMasterPasswordUsesSecretsManagerSecret() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("ClusterIdentifier", "managed-cluster");
params.putSingle("NodeType", "dc2.large");
params.putSingle("MasterUsername", "admin");
params.putSingle("ManageMasterPassword", "true");
params.putSingle("MasterPasswordSecretKmsKeyId", "arn:aws:kms:us-east-1:acc:key/key-1");
Cluster cluster = new Cluster();
cluster.setClusterIdentifier("managed-cluster");
cluster.setClusterStatus("available");
cluster.setMasterPasswordSecretArn("arn:aws:secretsmanager:us-east-1:acc:secret:redshift-managed");
cluster.setMasterPasswordSecretKmsKeyId("arn:aws:kms:us-east-1:acc:key/key-1");
when(service.createClusterWithManagedMasterPassword(any(), any(), any(), any(), any(), any(), any(), any()))
.thenReturn(cluster);
Response response = handler.handle("CreateCluster", params,
"AWS4-HMAC-SHA256 Credential=test/20260918/us-east-1/redshift/aws4_request");
assertEquals(200, response.getStatus());
String xml = (String) response.getEntity();
assertTrue(xml.contains("<MasterPasswordSecretArn>arn:aws:secretsmanager:us-east-1:acc:secret:redshift-managed</MasterPasswordSecretArn>"));
assertTrue(xml.contains("<MasterPasswordSecretKmsKeyId>arn:aws:kms:us-east-1:acc:key/key-1</MasterPasswordSecretKmsKeyId>"));
assertFalse(xml.contains("<MasterUserSecret>"));
verify(service).createClusterWithManagedMasterPassword(eq("managed-cluster"), eq("dc2.large"),
eq("admin"), isNull(), eq(List.of()), eq(List.of()),
eq("arn:aws:kms:us-east-1:acc:key/key-1"), eq("us-east-1"));
}
@Test
void createClusterParsesIamRoleArnLocationName() {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
@@ -16,6 +16,8 @@ import io.github.hectorvent.floci.services.redshift.model.Parameter;
import io.github.hectorvent.floci.services.redshift.model.Snapshot;
import io.github.hectorvent.floci.services.rds.proxy.PasswordValidator;
import io.github.hectorvent.floci.services.redshift.proxy.RedshiftProxyManager;
import io.github.hectorvent.floci.services.secretsmanager.SecretsManagerService;
import io.github.hectorvent.floci.services.secretsmanager.model.Secret;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
@@ -48,6 +50,7 @@ class RedshiftServiceTest {
private RedshiftProxyManager proxyManager;
private DockerHostResolver dockerHostResolver;
private RedshiftCredentialBroker credentialBroker;
private SecretsManagerService secretsManagerService;
private RedshiftService service;
@BeforeEach
@@ -88,9 +91,10 @@ class RedshiftServiceTest {
regionResolver = new RegionResolver("us-east-1", "111111111111");
credentialBroker = new RedshiftCredentialBroker();
secretsManagerService = mock(SecretsManagerService.class);
service = new RedshiftService(sf, cm, config, regionResolver, proxyManager, dockerHostResolver,
credentialBroker);
credentialBroker, secretsManagerService, new com.fasterxml.jackson.databind.ObjectMapper());
}
/** Absolute dump path as {@code createSnapshot} now stores it: under {@code <persistentPath>/redshift-dumps/<accountId>}. */
@@ -99,6 +103,45 @@ class RedshiftServiceTest {
.toAbsolutePath().normalize().toString();
}
@Test
void managedMasterPasswordCreatesOwnedSecretAndExposesItsMetadata() {
when(cm.start(eq("111111111111"), eq("managed-cluster"), eq("admin"), anyString()))
.thenReturn(new RedshiftContainerHandle("container", "managed-cluster", "localhost", 5432));
Secret secret = new Secret();
secret.setArn("arn:aws:secretsmanager:us-east-1:111111111111:secret:redshift-managed");
secret.setCurrentVersionId("version-1");
when(secretsManagerService.createSecret(eq("redshift/managed-cluster"), anyString(), isNull(),
anyString(), eq("arn:aws:kms:us-east-1:111111111111:key/key-1"), anyList(),
eq("redshift"), eq("us-east-1"))).thenReturn(secret);
Cluster cluster = service.createClusterWithManagedMasterPassword("managed-cluster", "dc2.large",
"admin", null, List.of(), List.of(),
"arn:aws:kms:us-east-1:111111111111:key/key-1", "us-east-1");
assertEquals(secret.getArn(), cluster.getMasterPasswordSecretArn());
assertEquals("arn:aws:kms:us-east-1:111111111111:key/key-1", cluster.getMasterPasswordSecretKmsKeyId());
verify(secretsManagerService).createSecret(eq("redshift/managed-cluster"),
contains("\"username\":\"admin\""), isNull(), anyString(),
eq("arn:aws:kms:us-east-1:111111111111:key/key-1"), anyList(), eq("redshift"), eq("us-east-1"));
}
@Test
void managedMasterPasswordRollsBackClusterWhenSecretCreationFails() {
when(cm.start(eq("111111111111"), eq("failed-managed-cluster"), eq("admin"), anyString()))
.thenReturn(new RedshiftContainerHandle("container", "failed-managed-cluster", "localhost", 5432));
when(secretsManagerService.createSecret(eq("redshift/failed-managed-cluster"), anyString(), isNull(),
anyString(), isNull(), anyList(), eq("redshift"), eq("us-east-1")))
.thenThrow(new AwsException("InternalFailure", "secret store unavailable", 500));
assertThrows(AwsException.class, () -> service.createClusterWithManagedMasterPassword(
"failed-managed-cluster", "dc2.large", "admin", null, List.of(), List.of(), null, "us-east-1"));
verify(cm).stop("111111111111", "failed-managed-cluster");
verify(clusterBackend).delete("failed-managed-cluster");
assertThrows(AwsException.class, () -> service.describeClusters("failed-managed-cluster"));
}
@Test
void testOnStartRecreatesContainersAcrossAccounts() {
Cluster clusterA = new Cluster();
@@ -48,7 +48,6 @@ AWS::RDS::DBInstance ResumeFullAutomationModeTime RDS Custom automation mode is
AWS::RDS::DBInstance SecondaryAvailabilityZone multi-AZ secondary placement is not emulated
AWS::RDS::DBInstance StatusInfos read-replica status detail is not emulated
AWS::Redshift::Cluster DeferMaintenanceIdentifier Floci does not emulate deferred maintenance windows
AWS::Redshift::Cluster MasterPasswordSecretArn only set when ManageMasterPassword is true, which Floci rejects
AWS::Route53::RecordSet Id schema gives no description; Ref returns the record name and the legacy spec gives the type no attributes
AWS::SQS::QueuePolicy Id schema gives no description; the policy has no backing entity to take an id from
AWS::SecretsManager::Secret Id Fn::GetAtt Id on a secret is its ARN, which the provisioner already sets as the physical id and as Arn; closable, deferred to a follow-up PR to keep this one a pure move
1 AWS::AppSync::GraphQLApi GraphQLEndpointArn the private-endpoint ARN of the GraphQL endpoint; Floci serves one public endpoint and has no private-endpoint model
48 AWS::RDS::DBInstance SecondaryAvailabilityZone multi-AZ secondary placement is not emulated
49 AWS::RDS::DBInstance StatusInfos read-replica status detail is not emulated
50 AWS::Redshift::Cluster DeferMaintenanceIdentifier Floci does not emulate deferred maintenance windows
AWS::Redshift::Cluster MasterPasswordSecretArn only set when ManageMasterPassword is true, which Floci rejects
51 AWS::Route53::RecordSet Id schema gives no description; Ref returns the record name and the legacy spec gives the type no attributes
52 AWS::SQS::QueuePolicy Id schema gives no description; the policy has no backing entity to take an id from
53 AWS::SecretsManager::Secret Id Fn::GetAtt Id on a secret is its ARN, which the provisioner already sets as the physical id and as Arn; closable, deferred to a follow-up PR to keep this one a pure move