Skip to content

Module Banner

terraform-aws-arc-sqs

Module: sourcefuse/arc-sqs/aws

Registry: https://registry.terraform.io/modules/sourcefuse/arc-sqs/aws

Category: Messaging / Queuing

Source: https://github.com/sourcefuse/terraform-aws-arc-sqs

Latest Release Last Updated Terraform GitHub Actions

Quality gate

Overview

Creates SQS queues (standard or FIFO) with dead letter queues, KMS encryption, access policies, and long polling.

What It Does

  • Standard and FIFO SQS queues
  • Dead letter queue (DLQ) with configurable max receive count
  • KMS encryption for messages at rest
  • Long polling configuration
  • Visibility timeout and message retention settings
  • Queue access policy management
  • Content-based deduplication for FIFO queues

Quickstart

module "sqs" {
  source  = "sourcefuse/arc-sqs/aws"
  version = "0.0.1"

  name = "my-application-queue"

  # Enable Dead Letter Queue for reliability
  dlq_config = {
    enabled           = true
    max_receive_count = 5
  }

  # Configure long polling for cost optimization
  message_config = {
    receive_wait_time_seconds = 20
    visibility_timeout        = 300
    retention_seconds         = 345600  # 4 days
  }

  tags = module.tags.tags

}

Examples

For detailed usage instructions, see the Module Usage Guide.

Required Inputs

Name Type Description
name string SQS queue name
## Key Outputs
Name Description
queue_url SQS queue URL
queue_arn SQS queue ARN
dlq_arn Dead letter queue ARN (if enabled)
## Full Variable & Output Reference

The complete inputs/outputs reference is auto-generated below.

Requirements

Name Version
terraform ~> 1.3, < 2.0.0
aws >= 5.0, < 7.0

Providers

Name Version
aws 6.16.0

Modules

Name Source Version
kms sourcefuse/arc-kms/aws 1.0.11

Resources

Name Type
aws_sqs_queue.dlq resource
aws_sqs_queue.this resource
aws_sqs_queue_policy.this resource
aws_caller_identity.current data source
aws_iam_policy_document.this data source

Inputs

Name Description Type Default Required
custom_redrive_policy JSON policy to specify an external dead-letter queue (instead of using dlq_config) string null no
dlq_config Dead Letter Queue configuration. Set enabled=true to create DLQ
object({
enabled = optional(bool, false)
name = optional(string, null)
max_receive_count = optional(number, 3)
message_retention_seconds = optional(number, 1209600)
delay_seconds = optional(number, 0)
max_message_size = optional(number, 262144)
receive_wait_time_seconds = optional(number, 0)
visibility_timeout = optional(number, 30)
content_based_deduplication = optional(bool, false)
deduplication_scope = optional(string, null)
throughput_limit = optional(string, null)
redrive_allow_policy = optional(string, null)
})
{
"enabled": false
}
no
fifo_config FIFO queue configuration. Set enabled=true for FIFO queue. deduplication_scope valid values: messageGroup, queue. throughput_limit valid values: perQueue, perMessageGroupId
object({
enabled = optional(bool, false)
content_based_deduplication = optional(bool, false)
deduplication_scope = optional(string, null)
throughput_limit = optional(string, null)
})
{
"enabled": false
}
no
kms_config KMS encryption configuration. If null, uses AWS managed SSE-SQS encryption
object({
key_arn = optional(string, null)
create_key = optional(bool, false)
data_key_reuse_period = optional(number, 300)
deletion_window_days = optional(number, 7)
rotation_enabled = optional(bool, true)
alias = optional(string, null)
policy = optional(string, null)
})
null no
message_config Message handling configuration
object({
delay_seconds = optional(number, 0)
max_message_size = optional(number, 262144)
retention_seconds = optional(number, 345600)
receive_wait_time_seconds = optional(number, 0)
visibility_timeout = optional(number, 30)
})
{} no
name Name of the SQS queue. If fifo_queue is set to true, the name must end with .fifo string n/a yes
policy_config Queue policy configuration
object({
create = optional(bool, false)
policy_json = optional(string, null)
source_policy_documents = optional(list(string), [])
override_policy_documents = optional(list(string), [])
})
{
"create": false
}
no
redrive_allow_policy JSON policy to control which source queues can specify this queue as their dead-letter queue string null no
tags A map of tags to assign to all resources map(string) {} no

Outputs

Name Description
dlq_arn The ARN of the SQS dead letter queue
dlq_id The URL for the created Amazon SQS dead letter queue
dlq_name The name of the SQS dead letter queue
dlq_url Same as dlq_id: The URL for the created Amazon SQS dead letter queue
kms_alias_arn The Amazon Resource Name (ARN) of the KMS alias
kms_alias_name The display name of the KMS alias
kms_key_arn The Amazon Resource Name (ARN) of the KMS key used for encryption
kms_key_id The globally unique identifier for the KMS key
queue_arn The ARN of the SQS queue
queue_id The URL for the created Amazon SQS queue
queue_name The name of the SQS queue
queue_policy The JSON policy of the SQS queue
queue_url Same as queue_id: The URL for the created Amazon SQS queue

Contributing

See CONTRIBUTING.md for commit conventions and development setup.

Authors

This project is authored by: - SourceFuse