Skip to main content
Service Catalog Version 0.118.1Last updated in version 0.96.1

Amazon Simple Notification Service

View Source Release Notes

Overview

This service contains code to create Amazon SNS topics.

SNS architectureSNS architecture

Features

  • Creates an SNS topic
  • Attaches topic policies allowing publishing, subscribing, or both from given AWS accounts
  • Optionally publishes notifications to Slack

Learn

note

This repo is a part of the Gruntwork Service Catalog, a collection of reusable, battle-tested, production ready infrastructure code. If you’ve never used the Service Catalog before, make sure to read How to use the Gruntwork Service Catalog!

Deploy

Non-production deployment (quick start for learning)

If you just want to try this repo out for experimenting and learning, check out the following resources:

  • examples/for-learning-and-testing folder: The examples/for-learning-and-testing folder contains standalone sample code optimized for learning, experimenting, and testing (but not direct production usage).

Production deployment

If you want to deploy this repo in production, check out the following resources:

Sample Usage

main.tf

# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S SNS-TOPICS MODULE
# ------------------------------------------------------------------------------------------------------

module "sns_topics" {

source = "git::git@github.com:gruntwork-io/terraform-aws-service-catalog.git//modules/networking/sns-topics?ref=v0.118.1"

# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------

# The name of the SNS topic
name = <string>

# ----------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# ----------------------------------------------------------------------------------------------------

# A list of IAM ARNs that will be given the rights to publish to the SNS
# topic.
allow_publish_accounts = []

# A list of AWS services that will be given the rights to publish to the SNS
# topic.
allow_publish_services = []

# A list of IAM ARNs that will be given the rights to subscribe to the SNS
# topic.
allow_subscribe_accounts = []

# A list of protocols that can be used to subscribe to the SNS topic.
allow_subscribe_protocols = ["http","https","email","email-json","sms","sqs","application","lambda"]

# Set to false to have this module create no resources. This weird parameter
# exists solely because Terraform does not support conditional modules.
# Therefore, this is a hack to allow you to conditionally decide if the
# resources should be created or not.
create_resources = true

# The display name of the SNS topic
display_name = ""

# The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a
# custom CMK
kms_master_key_id = "alias/aws/sns"

# The ARN of a Secrets Manager entry that contains the Slack Webhook URL
# (e.g., https://hooks.slack.com/services/FOO/BAR/BAZ) that SNS messages are
# sent to.
slack_webhook_url_secrets_manager_arn = null

}


Reference

Required

namestringrequired

The name of the SNS topic

Optional

allow_publish_accountslist(string)optional

A list of IAM ARNs that will be given the rights to publish to the SNS topic.

[]
allow_publish_serviceslist(string)optional

A list of AWS services that will be given the rights to publish to the SNS topic.

[]
allow_subscribe_accountslist(string)optional

A list of IAM ARNs that will be given the rights to subscribe to the SNS topic.

[]
allow_subscribe_protocolslist(string)optional

A list of protocols that can be used to subscribe to the SNS topic.

[
"http",
"https",
"email",
"email-json",
"sms",
"sqs",
"application",
"lambda"
]
create_resourcesbooloptional

Set to false to have this module create no resources. This weird parameter exists solely because Terraform does not support conditional modules. Therefore, this is a hack to allow you to conditionally decide if the resources should be created or not.

true
display_namestringoptional

The display name of the SNS topic

""
kms_master_key_idstringoptional

The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK

"alias/aws/sns"

The ARN of a Secrets Manager entry that contains the Slack Webhook URL (e.g., https://hooks.slack.com/services/FOO/BAR/BAZ) that SNS messages are sent to.

null