# terraform-sqs

## Overview
This module can provision an SQS queue and FIFO queue. Both can be provisioned with an optional deadletter queue. 

## Usage
See the examples directory for usage.

### SQS Settings
This module creates a queue with the name `${var.environment}-${var.queue_name}-queue`. 

A FIFO queue can be created optionally with `sqs_fifo_queue`. `content_based_deduplication` is set based on the bool value of `sqs_fifo_queue`. 
The following naming convention is applied for FIFO: `${var.environment}-${var.queue_name}-fifo-queue.fifo`.

A deadletter queue can be specified by setting the `sqs_deadletter_enabled` variable to `"true"`. When set to `"true"` the name of the 
deadletter queue provisioned is `${var.environment}-${var.queue_name}-deadletter` or `"${var.environment}-${var.queue_name}-fifo-deadletter.fifo"` if the 
queue is FIFO. 

Deadletter queues must be of the same type (FIFO/non-FIFO) as the main queue.

### Encryption Settings
This module supports two encryption types controlled by the `sqs_encryption_type` variable:

- **sse-sqs**: Uses SSE-SQS (Amazon SQS managed encryption). Recommended when external AWS services (like Amazon Music) need to publish messages to the queue without KMS key permissions.
- **kms** (default): Uses KMS encryption with the key specified in `sqs_kms_master_key_id`.

To switch to SSE-SQS encryption:
```hcl
module "sqs" {
  source = "..."
  
  sqs_encryption_type = "sse-sqs"
  # ... other variables
}
```

