Guest User

Untitled

a guest
Nov 24th, 2020 (edited)
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. resource "aws_sns_topic" "CW-alerts" {
  2. count = length(var.sns-topic-recipient)
  3. name = join("", [var.sns-topic-recipient[count.index].name])
  4. provisioner "local-exec" {
  5. command = "./sns_subscription.sh"
  6. environment = {
  7. sns_arn = self.arn
  8. sns_emails = var.sns-subscription-email-address-list[count.index].email-address
  9. }
  10. }
  11. tags = merge(var.tags, { "Name" = join("", [var.tags.Environment, "-", var.sns-subscription-email-address-list[count.index].name]) })
  12. }
  13.  
  14. resource aws_sns_topic_policy "CW-alerts-topic-policy" {
  15. count = length(var.sns-topic-recipient)
  16. arn = aws_sns_topic.CW-alerts[count.index].arn
  17. policy = templatefile(join("", [path.module, "/cw-topic-policy.tpl"]), {
  18. region = join("", ["arn:aws:sns:", var.region, ":", var.aws-account, ":", var.sns-topic-recipient[count.index].name])
  19. aws-account = var.aws-account
  20. })
  21. }
Advertisement
Add Comment
Please, Sign In to add comment