taskcat icon indicating copy to clipboard operation
taskcat copied to clipboard

SQS: Resource dependencies are not circular

Open alucard001 opened this issue 2 years ago • 0 comments

I got the following error of circular reference when creating SQS.

[Resource dependencies are not circular] Circular Dependencies for resource SQSSendNotifications. Circular dependency with [SQSSendNotificationsDeadLetterQueue]
Resource dependencies are not circular] Circular Dependencies for resource SQSSendNotificationsDeadLetterQueue. Circular dependency with [SQSSendNotifications]

Here is my CloudFormation file for SQS:

Resources:
  SQSSendNotifications:
    Type: AWS::SQS::Queue
    Properties:
      DeduplicationScope: messageGroup
      FifoQueue: true
      FifoThroughputLimit: perMessageGroupId
      KmsDataKeyReusePeriodSeconds: 3600
      MessageRetentionPeriod: 300
      QueueName: sso-sendnotification.fifo

      RedriveAllowPolicy:
        Fn::ToJsonString:
          - redrivePermission: denyAll

      RedrivePolicy:
        Fn::ToJsonString:
          - deadLetterTargetArn: !GetAtt SQSSendNotificationsDeadLetterQueue.Arn
            maxReceiveCount: 3

      SqsManagedSseEnabled: true

  SQSSendNotificationsDeadLetterQueue:
    Type: AWS::SQS::Queue
    Properties:
      DeduplicationScope: messageGroup
      FifoQueue: true
      FifoThroughputLimit: perMessageGroupId
      KmsDataKeyReusePeriodSeconds: 86400
      MessageRetentionPeriod: 1209600
      QueueName: sso-sendnotification-dl.fifo
      RedriveAllowPolicy:
        Fn::ToJsonString:
          - redrivePermission: byQueue
            sourceQueueArns: !GetAtt SQSSendNotifications.Arn

I know that there is a clear "circular-reference" in the queue and DL-queue seciton. But here is what I want to ask: From the logic standpoint:

  • SQSSendNotifications "denyAll" queue from using this queue as DL
  • SQSSendNotifications will redirect all failed messages to SQSSendNotificationsDeadLetterQueue.Arn

While

  • SQSSendNotificationsDeadLetterQueue only accept (i.e. byQueue) this queue as source queue: SQSSendNotifications.Arn
  • There is no RedrivePolicy as this is a DL queue.

If the logic above is correct, why would there be a "circular reference" and throw error? These two different sections referring each other, which is normal and correct.

Can anyone please help explain it to me?

Thank you very much.

alucard001 avatar Feb 24 '23 08:02 alucard001