Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we add an SNS topic from Terraform with Email subscription

Hi I was wondering if we can add an SNS topic from Terraform with Email subscription.

So it will be easy to setup Alarms and create SNS topic to send alert to an email with one “Terraform apply” command.

Thanks

like image 791
Hasan Raza Avatar asked Mar 01 '23 15:03

Hasan Raza


1 Answers

resource "aws_sns_topic" "topic" {
  name = "topic-name"
}

resource "aws_sns_topic_subscription" "email-target" {
  topic_arn = aws_sns_topic.topic.arn
  protocol  = "email"
  endpoint  = "[email protected]"
}
like image 96
Masoud Avatar answered Apr 09 '23 08:04

Masoud