Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

humn-ai/tf-mod-aws-sqs

 
 

Repository files navigation

AWS SQS Terraform module

Terraform module which creates SQS resources on AWS.

Usage

module "user_queue" {
  source  = "terraform-aws-modules/sqs/aws"
  version = "~> 2.0"

  name = "user"

  tags = {
    Service     = "user"
    Environment = "dev"
  }
}

Examples

Conditional creation

Sometimes you need to have a way to create SQS queue conditionally but Terraform does not allow to use count inside module block, so the solution is to specify argument create.

# This SQS queue will not be created
module "user_queue" {
  source  = "terraform-aws-modules/sqs/aws"
  version = "~> 2.0"

  create = false
  # ... omitted
}
## Requirements
Name Version
terraform >= 0.12.7
aws >= 2.30

Providers

Name Version
aws >= 2.30

Modules

Name Source Version
this cloudposse/label/null 0.24.1

Resources

Name Type
aws_sqs_queue.this resource
aws_arn.this data source

Inputs

Name Description Type Default Required
additional_tag_map Additional tags for appending to tags_as_list_of_maps. Not added to tags. map(string) {} no
attributes Additional attributes (e.g. 1) list(string) [] no
content_based_deduplication Enables content-based deduplication for FIFO queues bool false no
context Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as null to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional_tag_map, which are merged.
any
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
no
create Whether to create SQS queue bool true no
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) number 0 no
delimiter Delimiter to be used between namespace, environment, stage, name and attributes.
Defaults to - (hyphen). Set to "" to use no delimiter at all.
string null no
enabled Set to false to prevent the module from creating any resources bool null no
environment Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' string null no
fifo_queue Boolean designating a FIFO queue bool false no
id_length_limit Limit id to this many characters (minimum 6).
Set to 0 for unlimited length.
Set to null for default, which is 0.
Does not affect id_full.
number null no
kms_data_key_reuse_period_seconds The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours) number 300 no
kms_master_key_id The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK string null no
label_key_case The letter case of label keys (tag names) (i.e. name, namespace, environment, stage, attributes) to use in tags.
Possible values: lower, title, upper.
Default value: title.
string null no
label_order The naming order of the id output and Name tag.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 5 elements, but at least one must be present.
list(string) null no
label_value_case The letter case of output label values (also used in tags and id).
Possible values: lower, title, upper and none (no transformation).
Default value: lower.
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) number 262144 no
message_retention_seconds The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days) number 345600 no
name Solution name, e.g. 'app' or 'jenkins' string null no
name_prefix A unique name beginning with the specified prefix. string null no
namespace Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' string null no
policy The JSON policy for the SQS queue string "" 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) number 0 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 "" no
regex_replace_chars Regex to replace chars with empty string in namespace, environment, stage and name.
If not set, "/[^a-zA-Z0-9-]/" is used to remove all characters other than hyphens, letters and digits.
string null no
stage Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' string null no
tags Additional tags (e.g. map('BusinessUnit','XYZ') map(string) {} no
visibility_timeout_seconds The visibility timeout for the queue. An integer from 0 to 43200 (12 hours) number 30 no

Outputs

Name Description
sqs_queue_arn The ARN of the SQS queue
sqs_queue_id The URL for the created Amazon SQS queue
sqs_queue_name The name of the SQS queue

Authors

Module is maintained by Anton Babenko with help from these awesome contributors.

License

Apache 2 Licensed. See LICENSE for full details.

Packages

No packages published

Languages

  • HCL 98.7%
  • Makefile 1.3%