This module creates AWS SNS Topic.
# main.tf
module "sns_topic" {
source = "git::https://github.com/lpavliuk/Terraform-Modules.git//aws_sns_topic"
name = "slack-channel"
subscriptions = [
{ # Slack channel : "infra-alerts"
protocol = "email"
endpoint = "example@slack.com"
}
]
policy_statements = [
{
sid = "AllowManageSNS"
effect = "Allow"
actions = [
"SNS:Subscribe",
"SNS:Publish",
"SNS:ListSubscriptionsByTopic",
"SNS:GetTopicAttributes"
]
principals = {
type = "AWS"
identifiers = ["*"]
}
condition = {
test = "StringEquals"
variable = "AWS:SourceOwner"
values = ["<AWS_ACCOUNT_ID>"]
}
},
{
sid = "AllowBackupSNS"
effect = "Allow"
actions = [
"SNS:Publish",
]
principals = {
type = "Service"
identifiers = ["backup.amazonaws.com"]
}
}
]
}
Name | Version |
---|---|
terraform | < 2.0.0, >= 1.6.6 |
aws | < 6.0, >= 5.22 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | Topic Name | string |
n/a | yes |
policy_statements | Policy Statements of the SNS Topic | list(object({ |
n/a | yes |
subscriptions | Subscriptions for the SNS Topic. Available protocol values:- sqs - sms - lambda - firehose - application - email - email-json - http - https More details... |
list(object({ |
[] |
no |
Name | Description |
---|---|
id | Topic ID |
arn | Topic ARN |
name | Topic Name |
subscriptions | Topic Subscriptions |
Name | Type |
---|---|
aws_sns_topic.this | resource |
aws_sns_topic_policy.this | resource |
aws_sns_topic_subscription.this | resource |
aws_caller_identity.current | data source |
aws_iam_policy_document.sns_topic_policy | data source |