Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- resource "aws_sns_topic" "CW-alerts" {
- count = length(var.sns-topic-recipient)
- name = join("", [var.sns-topic-recipient[count.index].name])
- provisioner "local-exec" {
- command = "./sns_subscription.sh"
- environment = {
- sns_arn = self.arn
- sns_emails = var.sns-subscription-email-address-list[count.index].email-address
- }
- }
- tags = merge(var.tags, { "Name" = join("", [var.tags.Environment, "-", var.sns-subscription-email-address-list[count.index].name]) })
- }
- resource aws_sns_topic_policy "CW-alerts-topic-policy" {
- count = length(var.sns-topic-recipient)
- arn = aws_sns_topic.CW-alerts[count.index].arn
- policy = templatefile(join("", [path.module, "/cw-topic-policy.tpl"]), {
- region = join("", ["arn:aws:sns:", var.region, ":", var.aws-account, ":", var.sns-topic-recipient[count.index].name])
- aws-account = var.aws-account
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment