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