Simple Notification Service (SNS) Topic Module
View SourceRelease NotesThis module makes it easy to deploy a SNS topic along with the publisher and subscriber policies for the topic.
How do I access the SNS topic?
This module includes several Terraform outputs, including:
- topic_name: The Name of the created topic
- topic_display_name: The Display Name of the created topic
- topic_arn: The ARN of the created topic
- topic_policy: The Access policy of the created topic
Sample Usage
- Terraform
- Terragrunt
# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S SNS MODULE
# ------------------------------------------------------------------------------------------------------
module "sns" {
  source = "git::git@github.com:gruntwork-io/terraform-aws-messaging.git//modules/sns?ref=v0.12.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 are allowed for subscription.
  allow_subscribe_protocols = ["http","https","email","email-json","sms","sqs","application","lambda"]
  # Enable or disable creation of the resources of this module.
  create_resources = true
  # (optional) Delivery policy for sns topic.
  delivery_policy = null
  # The display name of the SNS topic. NOTE: Maximum length is 100 characters.
  display_name = ""
  # ARN of the http failure feedback role - when using delivery policy for sns
  # topic.
  http_failure_feedback_role_arn = null
  # ARN of the http success feedback role - when using delivery policy for sns
  # topic.
  http_success_feedback_role_arn = null
  # The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a
  # custom CMK
  kms_master_key_id = null
  # A map of key value pairs to apply as tags to the SNS topic.
  tags = {}
}
# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S SNS MODULE
# ------------------------------------------------------------------------------------------------------
terraform {
  source = "git::git@github.com:gruntwork-io/terraform-aws-messaging.git//modules/sns?ref=v0.12.1"
}
inputs = {
  # ----------------------------------------------------------------------------------------------------
  # 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 are allowed for subscription.
  allow_subscribe_protocols = ["http","https","email","email-json","sms","sqs","application","lambda"]
  # Enable or disable creation of the resources of this module.
  create_resources = true
  # (optional) Delivery policy for sns topic.
  delivery_policy = null
  # The display name of the SNS topic. NOTE: Maximum length is 100 characters.
  display_name = ""
  # ARN of the http failure feedback role - when using delivery policy for sns
  # topic.
  http_failure_feedback_role_arn = null
  # ARN of the http success feedback role - when using delivery policy for sns
  # topic.
  http_success_feedback_role_arn = null
  # The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a
  # custom CMK
  kms_master_key_id = null
  # A map of key value pairs to apply as tags to the SNS topic.
  tags = {}
}
Reference
- Inputs
- Outputs
Required
namestringThe name of the SNS topic.
Optional
allow_publish_accountslist(string)A list of IAM ARNs that will be given the rights to publish to the SNS topic.
[]allow_publish_serviceslist(string)A list of AWS services that will be given the rights to publish to the SNS topic.
[]allow_subscribe_accountslist(string)A list of IAM ARNs that will be given the rights to subscribe to the SNS topic.
[]allow_subscribe_protocolslist(string)A list of protocols that are allowed for subscription.
[
  "http",
  "https",
  "email",
  "email-json",
  "sms",
  "sqs",
  "application",
  "lambda"
]
create_resourcesboolEnable or disable creation of the resources of this module.
true(optional) Delivery policy for sns topic.
Any types represent complex values of variable type. For details, please consult `variables.tf` in the source repo.
nulldisplay_namestringThe display name of the SNS topic. NOTE: Maximum length is 100 characters.
""ARN of the http failure feedback role - when using delivery policy for sns topic.
nullARN of the http success feedback role - when using delivery policy for sns topic.
nullkms_master_key_idstringThe ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK
nulltagsmap(string)A map of key value pairs to apply as tags to the SNS topic.
{}