AWS SNS Topic Terraform module
Terraform module which creates SNS resources on AWS
module "sns_topic" {
source = " terraform-aws-modules/sns/aws"
name = " simple"
tags = {
Environment = " dev"
Terraform = " true"
}
}
Topic w/ SQS Subscription
module "sns_topic" {
source = " terraform-aws-modules/sns/aws"
name = " pub-sub"
topic_policy_statements = {
pub = {
actions = [" sns:Publish" ]
principals = [{
type = " AWS"
identifiers = [" arn:aws:iam::66666666666:role/publisher" ]
}]
},
sub = {
actions = [
" sns:Subscribe" ,
" sns:Receive" ,
]
principals = [{
type = " AWS"
identifiers = [" *" ]
}]
conditions = [{
test = " StringLike"
variable = " sns:Endpoint"
values = [" arn:aws:sqs:eu-west-1:11111111111:subscriber" ]
}]
}
}
subscriptions = {
sqs = {
protocol = " sqs"
endpoint = " arn:aws:sqs:eu-west-1:11111111111:subscriber"
}
}
tags = {
Environment = " dev"
Terraform = " true"
}
}
FIFO Topic w/ FIFO SQS Subscription
module "sns_topic" {
source = " terraform-aws-modules/sns/aws"
name = " my-topic"
# SQS queue must be FIFO as well
fifo_topic = true
content_based_deduplication = true
topic_policy_statements = {
pub = {
actions = [" sns:Publish" ]
principals = [{
type = " AWS"
identifiers = [" arn:aws:iam::66666666666:role/publisher" ]
}]
},
sub = {
actions = [
" sns:Subscribe" ,
" sns:Receive" ,
]
principals = [{
type = " AWS"
identifiers = [" *" ]
}]
conditions = [{
test = " StringLike"
variable = " sns:Endpoint"
values = [" arn:aws:sqs:eu-west-1:11111111111:subscriber.fifo" ]
}]
}
}
subscriptions = {
sqs = {
protocol = " sqs"
endpoint = " arn:aws:sqs:eu-west-1:11111111111:subscriber.fifo"
}
}
tags = {
Environment = " dev"
Terraform = " true"
}
}
No modules.
Name
Description
Type
Default
Required
application_feedback
Map of IAM role ARNs and sample rate for success and failure feedback
map(string)
{}
no
archive_policy
The message archive policy for FIFO topics.
string
null
no
content_based_deduplication
Boolean indicating whether or not to enable content-based deduplication for FIFO topics.
bool
false
no
create
Determines whether resources will be created (affects all resources)
bool
true
no
create_subscription
Determines whether an SNS subscription is created
bool
true
no
create_topic_policy
Determines whether an SNS topic policy is created
bool
true
no
data_protection_policy
A map of data protection policy statements
string
null
no
delivery_policy
The SNS delivery policy
string
null
no
display_name
The display name for the SNS topic
string
null
no
enable_default_topic_policy
Specifies whether to enable the default topic policy. Defaults to true
bool
true
no
fifo_topic
Boolean indicating whether or not to create a FIFO (first-in-first-out) topic
bool
false
no
firehose_feedback
Map of IAM role ARNs and sample rate for success and failure feedback
map(string)
{}
no
http_feedback
Map of IAM role ARNs and sample rate for success and failure feedback
map(string)
{}
no
kms_master_key_id
The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK
string
null
no
lambda_feedback
Map of IAM role ARNs and sample rate for success and failure feedback
map(string)
{}
no
name
The name of the SNS topic to create
string
null
no
override_topic_policy_documents
List of IAM policy documents that are merged together into the exported document. In merging, statements with non-blank sid
s will override statements with the same sid
list(string)
[]
no
signature_version
If SignatureVersion should be 1 (SHA1) or 2 (SHA256). The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS.
number
null
no
source_topic_policy_documents
List of IAM policy documents that are merged together into the exported document. Statements must have unique sid
s
list(string)
[]
no
sqs_feedback
Map of IAM role ARNs and sample rate for success and failure feedback
map(string)
{}
no
subscriptions
A map of subscription definitions to create
any
{}
no
tags
A map of tags to add to all resources
map(string)
{}
no
topic_policy
An externally created fully-formed AWS policy as JSON
string
null
no
topic_policy_statements
A map of IAM policy statements for custom permission usage
any
{}
no
tracing_config
Tracing mode of an Amazon SNS topic. Valid values: PassThrough, Active.
string
null
no
use_name_prefix
Determines whether name
is used as a prefix
bool
false
no
Module is maintained by Anton Babenko with help from these awesome contributors .
Apache 2 Licensed. See LICENSE for full details.