generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding SQS to manage messages in the SRE bot
- Loading branch information
1 parent
f52038d
commit 7a3985a
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
resource "aws_sqs_queue" "sre_bot_fifo_queue" { | ||
name = "sre-bot-fifo-queue.fifo" | ||
fifo_queue = true # Make sure that it is FIFO queue | ||
content_based_deduplication = true # Enable content-based deduplication | ||
delay_seconds = 0 # Specify delay time for messages | ||
visibility_timeout_seconds = 30 # Specify the visibility timeout | ||
|
||
depends_on = [aws_sqs_queue.sre_bot_dead_letter_queue] | ||
|
||
# Specify dead-letter queue (DLQ) settings | ||
redrive_policy = jsonencode({ | ||
deadLetterTargetArn = aws_sqs_queue.sre_bot_dead_letter_queue.arn | ||
maxReceiveCount = 5 # Number of times a message is delivered before sending to DLQ | ||
}) | ||
} | ||
|
||
# Dead-letter queue resource, which is used to store messages that cannot be processed | ||
resource "aws_sqs_queue" "sre_bot_dead_letter_queue" { | ||
name = "sre-bot-dead-letter-queue.fifo" | ||
fifo_queue = true | ||
} |