Skip to content

Instantly share code, notes, and snippets.

@elsdrium
Created July 25, 2018 04:29
Show Gist options
  • Save elsdrium/9f24251bdd868d282519aa6a79fbd50c to your computer and use it in GitHub Desktop.
Save elsdrium/9f24251bdd868d282519aa6a79fbd50c to your computer and use it in GitHub Desktop.
provider "aws" {
region = "${var.region}"
}
resource "aws_sns_topic" "ses_topic" {
# dots are not allowed in topic names, replace with _
name = "${replace(replace(var.domain,".", "_"), "@", "-")}_bounce_and_complaints"
}
resource "aws_ses_identity_notification_topic" "ses_bounce" {
topic_arn = "${aws_sns_topic.ses_topic.arn}"
notification_type = "Bounce"
identity = "${var.domain}"
}
resource "aws_ses_identity_notification_topic" "ses_complaint" {
topic_arn = "${aws_sns_topic.ses_topic.arn}"
notification_type = "Complaint"
identity = "${var.domain}"
}
# Delivery configuration
#resource "aws_ses_identity_notification_topic" "ses_delivery" {
# name = "${var.domain-name}_delivery_notifications"
# topic_arn = "${aws_sns_topic.ses_topic.arn}"
# notification_type = "Delivery"
# identity = "${var.domain}"
#}
resource "aws_sns_topic_subscription" "email_events_target" {
count = "${length(var.api-endpoints)}"
topic_arn = "${aws_sns_topic.ses_topic.arn}"
protocol = "http"
endpoint_auto_confirms = "true"
endpoint = "${var.api-endpoints[count.index]}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment