fix(redshift): emit ClusterAvailabilityStatus and AvailabilityZoneRelocationStatus (#3109)

DescribeClusters (and every other cluster response, since they share
buildClusterXml) omitted two fields the Terraform AWS provider requires:
ClusterAvailabilityStatus and AvailabilityZoneRelocationStatus. The
create waiter polled an empty ClusterAvailabilityStatus ("unexpected
state '', wanted target 'Available'") and import/read rejected the empty
AvailabilityZoneRelocationStatus.

ClusterAvailabilityStatus is derived from clusterStatus: available maps
to Available, unavailable to Unavailable, failed to Failed, and every
transient state to Modifying. Floci has no availability-zone relocation
feature, so AvailabilityZoneRelocationStatus is the constant "disabled".

Closes #3098
This commit is contained in:
Vũ Thế Huy authored and GitHub committed 2026-09-05 22:27:00 -04:00
1 parent 67bbd2cf13
commit 025ac714f6
4 files changed
+70 -2

No files matched your search

@@ -425,6 +425,8 @@ public class RedshiftQueryHandler {
.elem("NodeType", cluster.getNodeType())
.elem("MasterUsername", cluster.getMasterUsername())
.elem("ClusterStatus", cluster.getClusterStatus())
.elem("ClusterAvailabilityStatus", availabilityStatus(cluster.getClusterStatus()))
.elem("AvailabilityZoneRelocationStatus", "disabled")
.elem("ClusterSubnetGroupName", cluster.getClusterSubnetGroupName());
if (cluster.getVpcSecurityGroupIds() != null && !cluster.getVpcSecurityGroupIds().isEmpty()) {
@@ -465,6 +467,21 @@ public class RedshiftQueryHandler {
return builder.end("Cluster").build();
}
// Terraform's AWS provider polls ClusterAvailabilityStatus during create and validates it on
// read, so DescribeClusters must always carry it. Floci has no maintenance window concept, and
// every transient lifecycle state (creating, deleting, rebooting, modifying) maps to Modifying.
private static String availabilityStatus(String clusterStatus) {
if (clusterStatus == null) {
return "Modifying";
}
return switch (clusterStatus) {
case "available" -> "Available";
case "unavailable" -> "Unavailable";
case "failed" -> "Failed";
default -> "Modifying";
};
}
private String buildSnapshotXml(Snapshot snapshot) {
XmlBuilder builder = new XmlBuilder()
.start("Snapshot")