Created
July 25, 2018 04:29
-
-
Save elsdrium/9f24251bdd868d282519aa6a79fbd50c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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