Messages stuck in In-Flight status for SQS FIFO queue generated through Terraform

Viewed 572

Actually one weird issue I am facing in terms of SQS FIFO queues generated through terraform.

Initially, I tested my application with SQS queues created manually in the AWS console, which was working fine.

Later, I generated a new SQS FIFO queue through Terraform.

I checked configurations of both the queues in terms of access policy, KMS encryption, etc. They seem to be identical.

The visibility timeout set for both the queues is 30 seconds.

Now while I am testing my application with the terraform generated queue, every message is going to in-flight status and eventually is going to DLQ. None of the messages is getting delivered to the application. I checked the log as well, there seems to be no error as well.

I have configured the maximum receive count for a given message for the normal FIFO queue to be 3, before going to DLQ.

I am not getting any clue regarding why is this happening.

For better clarity, I am adding Terraform code snippet to generate the SQS:

module "queue_1" {
  source                      = "./modules/terraform-aws-sqs"
  key_alias                   = 
module.sqs_encryption_queue_dlq.kms_key_alias
  service_name                = var.project_name
  team_name                   = var.team_name
  name                        = "queue_1.fifo"
  fifo_queue                  = true
  visibility_timeout_seconds  = 30
  message_retention_seconds   = 86400
  content_based_deduplication = true
  redrive_policy = jsonencode({
    deadLetterTargetArn = module.dlq_1.sqs_queue_arn
    maxReceiveCount     = 3
  })
  platform_mandatory_tags = var.platform_mandatory_tags
}

module "dlq_1" {
  source                      = "./modules/terraform-aws-sqs"
  key_alias                   = 
  module.sqs_encryption_queue_dlq.kms_key_alias
  service_name                = var.project_name
  team_name                   = var.team_name
  name                        = "dlq_1.fifo"
  fifo_queue                  = true
  content_based_deduplication = true
  platform_mandatory_tags     = var.platform_mandatory_tags
}

module "sqs_encryption_queue_dlq" {
  source                  = "./modules/terraform-aws-kms2"
  key_alias               = "sqs_encryption_queue_dlq_key"
  key_description         = "KMS for queue and dlq"
  team_name               = var.team_name
  project_name            = var.project_name
  platform_mandatory_tags = var.platform_mandatory_tags
}
0 Answers
Related