Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
Last active November 7, 2025 14:27
Show Gist options
  • Select an option

  • Save chrisguitarguy/13b51ed584984fb3d9e9586aaeb1766f to your computer and use it in GitHub Desktop.

Select an option

Save chrisguitarguy/13b51ed584984fb3d9e9586aaeb1766f to your computer and use it in GitHub Desktop.
terraform sqs eample with dead letter queues
resource "aws_sqs_queue" "example" {
name = "example"
}
resource "aws_sqs_queue" "example-dlq" {
name = "example-dlq"
message_retention_seconds = 1209600 # 14 days
}
resource "aws_sqs_queue_redrive_allow_policy" "example-dlq" {
queue_url = aws_sqs_queue.example-dlq.url
redrive_allow_policy = jsonencode({
redrivePermission = "byQueue",
sourceQueueArns = [aws_sqs_queue.example.arn],
})
}
resource "aws_sqs_queue_redrive_policy" "example" {
queue_url = aws_sqs_queue.example.url
redrive_policy = jsonencode({
deadLetterTargetArn = aws_sqs_queue.example-dlq.arn
maxReceiveCount = 3
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment