Terraform module to create SNS topics.
##################
# SNS topic
##################
module "sns_topic_alarms" {
source = "git::https://github.com/virsas/terraform_sns_topic.git?ref=v1.0.0"
name = "alarms"
kms = module.kms-sns.arn
}
You require to create two polices located in ./json/sns directory
# Path
./json/sns_access/NAME.json
Name is the same as the name of the SNS topic
{
"Version": "2008-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "AWS": "*" },
"Action": [
"SNS:GetTopicAttributes",
"SNS:SetTopicAttributes",
"SNS:AddPermission",
"SNS:RemovePermission",
"SNS:DeleteTopic",
"SNS:Subscribe",
"SNS:ListSubscriptionsByTopic",
"SNS:Publish"
],
"Resource": "arn:aws:sns:eu-west-1:123456789012:alarms",
"Condition": { "StringEquals": { "AWS:SourceOwner": "123456789012" } }
}
]
}
123456789012 is the ID of your account.
# Path
./json/sns_delivery/NAME.json
Name is the same as the name of the SNS topic
{
"http": {
"defaultHealthyRetryPolicy": {
"minDelayTarget": 20,
"maxDelayTarget": 20,
"numRetries": 3,
"numMaxDelayRetries": 0,
"numNoDelayRetries": 0,
"numMinDelayRetries": 0,
"backoffFunction": "linear"
},
"disableSubscriptionOverrides": false
}
}
You can play with the configuration as per your needs.