Amazon Simple Notification Service
Overview
This service contains code to create Amazon SNS topics.
SNS 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!
- SNS Documentation: Amazon’s docs for SNS that cover core concepts and configuration
- How do SNS topics work?
- How do I get notified when a message is published to an SNS Topic?
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:
- examples/for-production folder: The
examples/for-production
folder contains sample code optimized for direct usage in production. This is code from the Gruntwork Reference Architecture, and it shows you how we build an end-to-end, integrated tech stack on top of the Gruntwork Service Catalog.
Reference
- Inputs
- Outputs
Required
name
stringThe name of the SNS topic
Optional
allow_publish_accounts
list(string)A list of IAM ARNs that will be given the rights to publish to the SNS topic.
[]
allow_publish_services
list(string)A list of AWS services that will be given the rights to publish to the SNS topic.
[]
allow_subscribe_accounts
list(string)A list of IAM ARNs that will be given the rights to subscribe to the SNS topic.
[]
allow_subscribe_protocols
list(string)A list of protocols that can be used to subscribe to the SNS topic.
[
"http",
"https",
"email",
"email-json",
"sms",
"sqs",
"application",
"lambda"
]
create_resources
boolSet 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_name
stringThe display name of the SNS topic
""
kms_master_key_id
stringThe 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
The ARN of the SNS topic.