From f3f8b422008afc4c4122c2b2bafedc6d49722dc2 Mon Sep 17 00:00:00 2001
From: Jackson Price <59149601+jprice8@users.noreply.github.com>
Date: Mon, 26 Oct 2026 16:10:49 -0500
Subject: [PATCH] feat(cloudformation): support AWS::Route53::RecordSetGroup
(#6676)
A RecordSetGroup writes all its record sets into one hosted zone in a
single ChangeResourceRecordSets batch, so a record set that cannot be
written, such as a name another owner already holds, leaves the zone
unchanged and fails the stack. Each record set keeps what a RecordSet
keeps, including the routing-policy fields SetIdentifier, Weight,
Region, Failover and HealthCheckId; entries an Fn::If resolves to
AWS::NoValue are dropped, and two record sets with one name, type and
set identifier are refused. Ref returns the group's logical ID and
Fn::GetAtt Id the change ID that GetChange reads, as AWS documents.
The zone comes from the group's HostedZoneId or HostedZoneName, or from
its record sets when the group names neither. A record set that repeats
the group's HostedZoneId is refused, as AWS documents, and so is one
that names another zone.
An update in the same zone deletes the records the group wrote and
creates the new ones in one batch. HostedZoneId and HostedZoneName are
create-only, so a change set reports a zone change as a replacement:
the records are written into the new zone, and the old ones are deleted
once the update commits, or kept under UpdateReplacePolicy: Retain. A
failed update puts back the records the group had; after a zone change
the group first points at its old records again, then deletes the new
zone's. If that delete fails, ContinueUpdateRollback retries it and
DeleteStack deletes those records while the rollback is unfinished;
anything else leaves them in their zone, since Route 53 cannot tell
them apart from an identical record another writer puts there later.
Deletes name the values the group wrote, so a record changed outside
the stack fails the delete rather than being removed.
The docs say what a record set group's failed rollback leaves behind.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---
docs/services/cloudformation.md | 13 +-
.../provisioners/Route53CfnProvisioner.java | 568 +++++++++++++++--
.../create-only-properties.json | 4 +
.../CfnCreateOnlyPropertiesTest.java | 9 +
...mationRoute53RecordSetIntegrationTest.java | 597 ++++++++++++++++++
.../Route53CfnProvisionerTest.java | 543 ++++++++++++++++
.../supported-resource-types.tsv | 1 +
tools/docs/cfn_resource_types.yaml | 3 +-
8 files changed, 1666 insertions(+), 72 deletions(-)
diff --git a/docs/services/cloudformation.md b/docs/services/cloudformation.md
index 6e68669cc8..10ea328e45 100644
--- a/docs/services/cloudformation.md
+++ b/docs/services/cloudformation.md
@@ -193,7 +193,7 @@ cross-resource references.
| Elastic Load Balancing v2 | `LoadBalancer`, `TargetGroup`, `Listener`, `ListenerRule` |
| Auto Scaling | `LaunchConfiguration`, `AutoScalingGroup`, `LifecycleHook`, `ScalingPolicy` |
| Application Auto Scaling | `ScalableTarget` (`ScheduledActions` are accepted and not run; Floci has no scheduled scaling), `ScalingPolicy` |
-| Route 53 | `HostedZone`, `RecordSet`, `HealthCheck` |
+| Route 53 | `HostedZone`, `RecordSet`, `RecordSetGroup` (written in one change batch, so a record set that cannot be written leaves the zone unchanged; every record set must be in the group's hosted zone), `HealthCheck` |
| Cloud Map | `HttpNamespace`, `PrivateDnsNamespace`, `PublicDnsNamespace`, `Service` |
| API Gateway (v1) | `RestApi`, `Resource`, `Authorizer`, `Method`, `Deployment`, `Stage`, `Account`, `DomainName`, `BasePathMapping`, `GatewayResponse`, `ApiKey`, `UsagePlan`, `UsagePlanKey` |
| API Gateway v2 | `Api`, `Authorizer`, `Route`, `Integration`, `Stage`, `Deployment`, `DomainName`, `ApiMapping`, `VpcLink` |
@@ -902,11 +902,18 @@ UPDATE_ROLLBACK_FAILED state and can not be updated.`). Two ways out remain:
delete failed; a resource whose restore cannot be redone fails again, leaving the stack in
`UPDATE_ROLLBACK_FAILED`, and can be passed in `ResourcesToSkip`. `ResourcesToSkip` names
`UPDATE_FAILED` resources to report as `UPDATE_COMPLETE` with the reason `Resource skipped
- during UpdateRollback`, without rolling them back; a skipped resource keeps the state the failed
- update left it in. Once every other resource rolled back, the stack reaches
+ during UpdateRollback`, without rolling them back; a skipped resource keeps the state its failed
+ update and rollback left it in. Once every other resource rolled back, the stack reaches
`UPDATE_ROLLBACK_COMPLETE` with the template, parameters and outputs from before the failed
update, and takes updates again.
+An `AWS::Route53::RecordSetGroup` whose zone-change rollback cannot delete the records it wrote into
+the new zone first points back at its old records, so the group already matches the template the
+stack rolls back to. `ContinueUpdateRollback` retries that delete, and `DeleteStack` deletes those
+records while the group is still `UPDATE_FAILED`, giving up after three attempts as for any replaced
+resource. Nothing else deletes them, since nothing tells them apart from an identical record written
+there later: once the group is skipped, or a later update commits, they stay in their zone.
+
`ForceRollback=true` skips every `UPDATE_FAILED` resource of the stack, each reported as a
`ResourcesToSkip` skip is. When a forced rollback skipped a resource and completes, the stack's
`StackStatusReason` and the reason of its `UPDATE_ROLLBACK_COMPLETE` event are `One or more
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Route53CfnProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Route53CfnProvisioner.java
index 1b4ff8fbc8..f534396423 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Route53CfnProvisioner.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Route53CfnProvisioner.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation.provisioners;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -8,6 +9,7 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import io.github.hectorvent.floci.services.route53.Route53Service;
import io.github.hectorvent.floci.services.route53.model.AliasTarget;
+import io.github.hectorvent.floci.services.route53.model.ChangeInfo;
import io.github.hectorvent.floci.services.route53.model.HealthCheck;
import io.github.hectorvent.floci.services.route53.model.HealthCheckConfig;
import io.github.hectorvent.floci.services.route53.model.HostedZone;
@@ -28,8 +30,8 @@ import java.util.Set;
import java.util.UUID;
/**
- * Provisions {@code AWS::Route53::HostedZone}, {@code AWS::Route53::RecordSet} and
- * {@code AWS::Route53::HealthCheck}.
+ * Provisions {@code AWS::Route53::HostedZone}, {@code AWS::Route53::RecordSet},
+ * {@code AWS::Route53::RecordSetGroup} and {@code AWS::Route53::HealthCheck}.
*
*
A record set is written into its hosted zone through {@code ChangeResourceRecordSets}. On stack
* create, and on an update that changes the record's identity (zone, Name, Type or SetIdentifier), the
@@ -41,11 +43,15 @@ import java.util.UUID;
* written without one. No {@code Fn::GetAtt} attribute is published: the registry lists {@code Id} as
* read-only, but the type has no registry handlers and the resource specification gives it no
* attributes, so {@code Ref} is its only reference.
+ *
+ *
A record set group writes all its record sets in one change batch; see
+ * {@link #provisionRecordSetGroup}.
*/
@ApplicationScoped
public class Route53CfnProvisioner implements CfnResourceProvisioner {
static final String HOSTED_ZONE = "AWS::Route53::HostedZone";
static final String RECORD_SET = "AWS::Route53::RecordSet";
+ static final String RECORD_SET_GROUP = "AWS::Route53::RecordSetGroup";
static final String HEALTH_CHECK = "AWS::Route53::HealthCheck";
/** The registry schema's create-only HealthCheckConfig members. */
@@ -62,6 +68,15 @@ public class Route53CfnProvisioner implements CfnResourceProvisioner {
private static final String RECORD_ZONE_ATTR = "__FlociRoute53RecordZoneId";
private static final String RECORD_TYPE_ATTR = "__FlociRoute53RecordType";
private static final String RECORD_SET_ID_ATTR = "__FlociRoute53RecordSetIdentifier";
+ // A group's records as it wrote them, which its DELETE changes must name exactly; its physical id
+ // and attributes before an update, kept until the update commits or rolls back; the records a
+ // failed update wrote that its rollback could not delete; and the cleanup's delete attempts.
+ private static final String GROUP_RECORDS_ATTR = "__FlociRoute53GroupRecords";
+ private static final String GROUP_UPDATE_ATTR = "__FlociRoute53GroupUpdate";
+ private static final String GROUP_OWED_ATTR = "__FlociRoute53GroupOwedDeletes";
+ private static final String GROUP_CLEANUP_ATTEMPTS_ATTR = "__FlociRoute53GroupCleanupAttempts";
+ private static final TypeReference> RECORDS = new TypeReference<>() { };
+ private static final TypeReference