I am having a lambda function for which I want to create an SQS dead letter queue. I started by creating the SQS in terraform:
resource "aws_sqs_queue" "my_lambda_dlq" {
name = "my_lambda_dlq"
delay_seconds = 90
max_message_size = 2048
message_retention_seconds = 86400
receive_wait_time_seconds = 10
redrive_policy = jsonencode({
deadLetterTargetArn = aws_sqs_queue.terraform_queue_deadletter.arn
maxReceiveCount = 4
})
tags = local.default_tags
}
This is the example from terraform. However, I got stuck at redrive_policy.
- Do I understand correctly, this sets a dead letter queue for the SQS queue?
- If I set redrive_policy, that implies I am setting a DLQ on a DLQ. I get the feeling that one can set a DLQ on a DLQ on a DLQ and so on.
I was not able to find any best practices regarding this. Does anyone have any experience with this?
My main goal here is not to loose any messages. Thanks, Luminita