mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(cloudformation): expose the RDS resource-id GetAtt attributes (#3527)
AWS::RDS::DBCluster declares DBClusterResourceId readOnly and AWS::RDS::DBInstance declares DbiResourceId, and RdsService already assigns both. Neither reached the stack resource, so Fn::GetAtt on either resolved to the literal "LogicalId.Attr" rather than the id, the silent failure mode Fn::GetAtt has when an attribute was never mapped. Invisible until now: the types were LEGACY_SWITCH, and CfnSchemaCoverageTest skips those. Moving them to a provisioner is what surfaced it. The other 17 attributes that surfaced with them stay recorded as gaps, because Floci does not emulate what they describe: read replicas, multi-AZ secondaries, point-in-time restore windows, RDS Custom automation. Endpoint and ReadEndpoint are recorded too, for a different reason: the dotted Endpoint.Address, Endpoint.Port and ReadEndpoint.Address are already set, and that is the form AWS's GetAtt exposes for these types. Both assertions fail against the previous commit, returning null.
This commit is contained in:
1 parent
5d0b0b44b1
commit
b618fa9033
3 files changed
+16
-2
No files matched your search
+6
@@ -250,6 +250,9 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
if (instance.getDbInstanceArn() != null) {
|
||||
r.getAttributes().put("DBInstanceArn", instance.getDbInstanceArn());
|
||||
}
|
||||
if (instance.getDbiResourceId() != null) {
|
||||
r.getAttributes().put("DbiResourceId", instance.getDbiResourceId());
|
||||
}
|
||||
}
|
||||
|
||||
private void provisionDbCluster(StackResource r, JsonNode props, CloudFormationTemplateEngine engine,
|
||||
@@ -322,6 +325,9 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
if (cluster.getDbClusterArn() != null) {
|
||||
r.getAttributes().put("DBClusterArn", cluster.getDbClusterArn());
|
||||
}
|
||||
if (cluster.getDbClusterResourceId() != null) {
|
||||
r.getAttributes().put("DBClusterResourceId", cluster.getDbClusterResourceId());
|
||||
}
|
||||
}
|
||||
|
||||
private Double parseServerlessV2Capacity(JsonNode props, String field,
|
||||
|
||||
+10
@@ -122,6 +122,7 @@ class RdsCfnProvisionerTest {
|
||||
when(instance.getDbInstanceIdentifier()).thenReturn("mydb");
|
||||
when(instance.getEndpoint()).thenReturn(new DbEndpoint("mydb.local", 5432));
|
||||
when(instance.getDbInstanceArn()).thenReturn("arn:aws:rds:us-east-1:000000000000:db:mydb");
|
||||
when(instance.getDbiResourceId()).thenReturn("db-ABCDEFGHIJKLMNOP");
|
||||
when(rdsService.createDbInstance(any(), any(), any(), any(), any(), any(), any(),
|
||||
anyInt(), anyBoolean(), any(), any(), any(), any(), anyBoolean(), anyBoolean(),
|
||||
any(), anyMap(), nullable(String.class))).thenReturn(instance);
|
||||
@@ -137,6 +138,9 @@ class RdsCfnProvisionerTest {
|
||||
assertEquals("mydb.local", r.getAttributes().get("Endpoint.Address"));
|
||||
assertEquals("5432", r.getAttributes().get("Endpoint.Port"));
|
||||
assertEquals("arn:aws:rds:us-east-1:000000000000:db:mydb", r.getAttributes().get("DBInstanceArn"));
|
||||
// The schema declares DbiResourceId readOnly and RdsService already assigns one, so it is
|
||||
// a real GetAtt key rather than a recorded gap.
|
||||
assertEquals("db-ABCDEFGHIJKLMNOP", r.getAttributes().get("DbiResourceId"));
|
||||
// CFN properties mapped to the create-method arguments; absent optionals are null.
|
||||
verify(rdsService).createDbInstance("mydb", "postgres", "16", "admin", "secret",
|
||||
"appdb", "db.t3.small", 50, false, null, null, null,
|
||||
@@ -168,6 +172,7 @@ class RdsCfnProvisionerTest {
|
||||
when(cluster.getEndpoint()).thenReturn(new DbEndpoint("mycluster.local", 5432));
|
||||
when(cluster.getReaderEndpoint()).thenReturn(new DbEndpoint("mycluster-ro.local", 5432));
|
||||
when(cluster.getDbClusterArn()).thenReturn("arn:aws:rds:us-east-1:000000000000:cluster:mycluster");
|
||||
when(cluster.getDbClusterResourceId()).thenReturn("cluster-ABCDEFGHIJKLMNOP");
|
||||
when(rdsService.createDbCluster(any(), any(), any(), any(), any(), any(), anyBoolean(), any(),
|
||||
any(), any(), anyBoolean(), any()))
|
||||
.thenReturn(cluster);
|
||||
@@ -181,6 +186,11 @@ class RdsCfnProvisionerTest {
|
||||
assertEquals("mycluster.local", r.getAttributes().get("Endpoint.Address"));
|
||||
assertEquals("mycluster-ro.local", r.getAttributes().get("ReadEndpoint.Address"));
|
||||
assertEquals("5432", r.getAttributes().get("Endpoint.Port"));
|
||||
assertEquals("arn:aws:rds:us-east-1:000000000000:cluster:mycluster",
|
||||
r.getAttributes().get("DBClusterArn"));
|
||||
// Same as DbiResourceId on the instance: declared readOnly and already assigned by the
|
||||
// service, so it belongs in the attributes rather than in the gaps file.
|
||||
assertEquals("cluster-ABCDEFGHIJKLMNOP", r.getAttributes().get("DBClusterResourceId"));
|
||||
verify(rdsService).createDbCluster("mycluster", "aurora-postgresql", "16.3",
|
||||
"admin", "secret", "appdb", false, null, null, null, false, "us-east-1");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ AWS::Pipes::Pipe CreationTime pipe lifecycle timestamps are not tracked
|
||||
AWS::Pipes::Pipe CurrentState pipe state transitions are not modelled
|
||||
AWS::Pipes::Pipe LastModifiedTime pipe lifecycle timestamps are not tracked
|
||||
AWS::Pipes::Pipe StateReason pipe state transitions are not modelled
|
||||
AWS::RDS::DBCluster DBClusterResourceId not set by the legacy switch; closable, deferred to a follow-up PR to keep this one a pure move
|
||||
AWS::RDS::DBCluster Endpoint the dotted Endpoint.Address and Endpoint.Port are set instead, which is the form AWS's GetAtt actually exposes
|
||||
AWS::RDS::DBCluster ReadEndpoint ReadEndpoint.Address is set instead, the form AWS's GetAtt exposes
|
||||
AWS::RDS::DBCluster StorageEncryptionType cluster storage encryption is not emulated
|
||||
@@ -34,7 +33,6 @@ AWS::RDS::DBCluster StorageThroughput provisioned storage throughput is not emul
|
||||
AWS::RDS::DBInstance AutomaticRestartTime instance restart scheduling is not emulated
|
||||
AWS::RDS::DBInstance CertificateDetails per-instance CA certificate metadata is not emulated
|
||||
AWS::RDS::DBInstance DBInstanceStatus the model carries no lifecycle status; instances reach available synchronously
|
||||
AWS::RDS::DBInstance DbiResourceId not set by the legacy switch; closable, deferred to a follow-up PR to keep this one a pure move
|
||||
AWS::RDS::DBInstance InstanceCreateTime creation timestamps are not recorded on the instance
|
||||
AWS::RDS::DBInstance IsStorageConfigUpgradeAvailable storage configuration upgrades are not emulated
|
||||
AWS::RDS::DBInstance LatestRestorableTime point-in-time restore windows are not emulated
|
||||
|
||||
|
Reference in new issue
Block a user