Created
July 4, 2026 14:54
-
-
Save nivleshc/96625475ddd4ae0ba3192b69e557b541 to your computer and use it in GitHub Desktop.
This gist contains code from sns.tf, which is part of the blog-amazon-macie-custom-eventbridge-events repository.
This file contains hidden or 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
| # SNS Topic for Macie job status notifications | |
| resource "aws_sns_topic" "macie_notifications" { | |
| name = local.sns.topic_name | |
| display_name = local.sns.display_name | |
| } | |
| # SNS Topic Policy to allow EventBridge to publish to the topic | |
| resource "aws_sns_topic_policy" "macie_notifications" { | |
| arn = aws_sns_topic.macie_notifications.arn | |
| policy = jsonencode({ | |
| Version = "2012-10-17" | |
| Id = "MacieJobStatusSNSPolicy" | |
| Statement = [ | |
| { | |
| Sid = "AllowEventBridgePublish" | |
| Effect = "Allow" | |
| Principal = { | |
| Service = "events.amazonaws.com" | |
| } | |
| Action = "SNS:Publish" | |
| Resource = aws_sns_topic.macie_notifications.arn | |
| Condition = { | |
| ArnEquals = { | |
| "aws:SourceArn" = aws_cloudwatch_event_rule.macie_job_status.arn | |
| } | |
| } | |
| } | |
| ] | |
| }) | |
| } | |
| # SNS Topic Subscription - Email notification | |
| resource "aws_sns_topic_subscription" "email" { | |
| topic_arn = aws_sns_topic.macie_notifications.arn | |
| protocol = "email" | |
| endpoint = var.email_for_notifications | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment