Skip to content

pbs/terraform-aws-sqs-module

Repository files navigation

PBS TF SQS Module

Installation

Using the Repo Source

Use this URL for the source of the module. See the usage examples below for more details.

github.com/pbs/terraform-aws-sqs-module?ref=0.0.18

Alternative Installation Methods

More information can be found on these install methods and more in the documentation here.

Usage

Provisions an SQS queue.

Integrate this module like so:

module "queue" {
  source = "github.com/pbs/terraform-aws-sqs-module?ref=0.0.18"

  organization = var.organization
  environment  = var.environment
  product      = var.product
  repo         = var.repo
}

If you need to integrate a secondary queue as a dead letter queue, this would be a valid configuration:

module "queue" {
  source = "github.com/pbs/terraform-aws-sqs-module?ref=0.0.18"

  name = "my-queue"

  redrive_policy = jsonencode({
    deadLetterTargetArn = module.dlq.arn
    maxReceiveCount     = 5
  })

  organization = var.organization
  environment  = var.environment
  product      = var.product
  repo         = var.repo
}

module "dlq" {
  source = "github.com/pbs/terraform-aws-sqs-module?ref=0.0.18"

  name = "my-queue-dlq"

  organization = var.organization
  environment  = var.environment
  product      = var.product
  repo         = var.repo
}

Adding This Version of the Module

If this repo is added as a subtree, then the version of the module should be close to the version shown here:

0.0.18

Note, however that subtrees can be altered as desired within repositories.

Further documentation on usage can be found here.

Below is automatically generated documentation on this Terraform module using terraform-docs


Requirements

Name Version
terraform >= 1.3.2
aws >= 4.5.0

Providers

Name Version
aws 5.24.0

Modules

No modules.

Resources

Name Type
aws_sqs_queue.queue resource
aws_default_tags.common_tags data source

Inputs

Name Description Type Default Required
environment Environment (sharedtools, dev, staging, qa, prod) string n/a yes
organization Organization using this module. Used to prefix tags so that they are easily identified as being from your organization string n/a yes
product Tag used to group resources according to product string n/a yes
repo Tag used to point to the repo using this module string n/a yes
delay_seconds The time in seconds that the delivery of all messages in the queue will be delayed. An integer from 0 to 900 (15 minutes). The default for this attribute is 0 seconds. string null no
max_message_size The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute is 262144 (256 KiB). number null no
message_retention_seconds The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days). The default for this attribute is 345600 (4 days). number null no
name Name of the SQS Queue string null no
receive_wait_time_seconds The time for which a ReceiveMessage call will wait for a message to arrive (long polling) before returning. An integer from 0 to 20 (seconds). The default for this attribute is 0, meaning that the call will return immediately. number null no
redrive_policy The JSON policy to set up the Dead Letter Queue, see AWS docs. Note: when specifying maxReceiveCount, you must specify it as an integer (5), and not a string ("5"). string null no
sqs_managed_sse_enabled Boolean to enable server-side encryption (SSE) of message content with SQS-owned encryption keys. See Encryption at rest. Terraform will only perform drift detection of its value when present in a configuration. bool true no
tags Extra tags map(string) {} no
use_prefix Create queue with prefix instead of explicit name bool true no
visibility_timeout_seconds The visibility timeout for the queue. An integer from 0 to 43200 (12 hours). The default for this attribute is 30. For more information about visibility timeout, see AWS docs. number null no

Outputs

Name Description
arn The ARN of the SQS queue
name The name of the SQS queue
url The URL of the SQS queue