Skip to content

Simple Notification Service (SNS)

Publishes a message to a topic that every subscriber receives at once. SNS decouples the publisher from its subscribers, so you can add or remove consumers without changing the service that sends the message. Subscribers can be SQS queues, or other endpoints such as email, SMS, and HTTP.

Byks guides

Terraform configuration

Each entry in the sns_topics map deploys one SNS topic. The map key becomes the topic name.

main.tf
module "application" {
  source = "git@github.com:BYM-IKT/terraform-byks-module.git?ref=v12"
  # ...

  sns_topics = {
    kattehotell-booking-created = {
      # options go here
    }
  }
}

Options

Option Type Default Description
subscriptions any {} Subscribe endpoints directly to the topic, for protocols other than SQS queues defined in sqs_queues. Each entry needs endpoint and subscription_protocol, one of sqs, sms, lambda, firehose, application, email, email-json, http, or https.
override_name string null Custom topic name, instead of the generated default.
sqs_subscriptions map(object) {} Subscribe SQS queues defined in sqs_queues to the topic. See SQS subscription object.

SQS subscription object

Used in sqs_subscriptions. The map key must match a queue defined in sqs_queues.

Option Type Default Description
override_sqs_queue_arn string null Declared for overriding the destination queue, but the module doesn't read it. The subscription always targets the queue whose key in sqs_queues matches this map's key.
raw_message_delivery bool false Deliver the raw message instead of wrapping it in a JSON envelope.

Resources