diff --git a/packages/aws-cdk-lib/aws-sqs/lib/queue.ts b/packages/aws-cdk-lib/aws-sqs/lib/queue.ts index e0e5503c3704c..d05f886cc22a8 100644 --- a/packages/aws-cdk-lib/aws-sqs/lib/queue.ts +++ b/packages/aws-cdk-lib/aws-sqs/lib/queue.ts @@ -560,7 +560,11 @@ export class Queue extends QueueBase { contentBasedDeduplication: props.contentBasedDeduplication, deduplicationScope: props.deduplicationScope, fifoThroughputLimit: props.fifoThroughputLimit, - fifoQueue, + + // This value will be passed directly into the L1 props, but the underlying `AWS::SQS::Queue` + // does not accept `FifoQueue: false`. It must either be `true` or absent. So change a `false` into + // an `undefined`. + fifoQueue: fifoQueue ? true : undefined, }; } diff --git a/packages/aws-cdk-lib/aws-sqs/test/sqs.test.ts b/packages/aws-cdk-lib/aws-sqs/test/sqs.test.ts index 0ae7bc2919ef5..690eb0ec275be 100644 --- a/packages/aws-cdk-lib/aws-sqs/test/sqs.test.ts +++ b/packages/aws-cdk-lib/aws-sqs/test/sqs.test.ts @@ -675,6 +675,28 @@ test('test a queue throws when deduplicationScope specified on non fifo queue', }).toThrow(); }); +test('fifo: false is dropped from properties', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new sqs.Queue(stack, 'Queue', { + fifo: false, + }); + + // THEN + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'Properties': Match.absent(), + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); +}); + test('test metrics', () => { // GIVEN const stack = new Stack();