fix(cloudformation): preserve Targets[].SqsParameters on AWS::Events::Rule (#793)

CloudFormationResourceProvisioner.provisionEventBridgeRule was reading
only Id/Arn/Input/InputPath from each target node and dropping
SqsParameters. EventBridge then delivered to FIFO SQS queues without a
MessageGroupId, which AWS rejects with:

  The request must contain the parameter MessageGroupId.

The same target works when registered via the direct events PutTargets
API path, which already parses SqsParameters.MessageGroupId in
EventBridgeHandler. The CFN provisioner now mirrors that logic so
CloudFormation-managed FIFO targets behave identically to direct ones.

Closes #787
This commit is contained in:
Ben Younes authored and GitHub committed 2026-05-12 00:07:38 -05:00
1 parent c8c77c9e6e
commit 31f9ade3a6
2 files changed
+369 -1

No files matched your search

@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import io.github.hectorvent.floci.services.dynamodb.DynamoDbService;
import io.github.hectorvent.floci.services.eventbridge.EventBridgeService;
import io.github.hectorvent.floci.services.eventbridge.model.RuleState;
import io.github.hectorvent.floci.services.eventbridge.model.SqsParameters;
import io.github.hectorvent.floci.services.eventbridge.model.Target;
import io.github.hectorvent.floci.services.dynamodb.model.AttributeDefinition;
import io.github.hectorvent.floci.services.dynamodb.model.GlobalSecondaryIndex;
@@ -1177,7 +1178,17 @@ public class CloudFormationResourceProvisioner {
String input = resolved.path("Input").asText(null);
String inputPath = resolved.path("InputPath").asText(null);
if (targetId != null && targetArn != null) {
targets.add(new Target(targetId, targetArn, input, inputPath));
Target target = new Target(targetId, targetArn, input, inputPath);
JsonNode sqsParamsNode = resolved.path("SqsParameters");
if (!sqsParamsNode.isMissingNode() && sqsParamsNode.isObject()) {
String messageGroupId = sqsParamsNode.path("MessageGroupId").asText(null);
if (messageGroupId != null) {
SqsParameters sqsParameters = new SqsParameters();
sqsParameters.setMessageGroupId(messageGroupId);
target.setSqsParameters(sqsParameters);
}
}
targets.add(target);
}
}
if (!targets.isEmpty()) {