resource "aws_sns_topic" "lambda_error_alerts" {
  # checkov:skip=CKV_AWS_26:Ensure all data stored in the SNS topic is encrypted
  name = "Lbcpyp_Lambda_CloudWatch_Alarms_Topic"

  tags = merge(var.common_tags, {
    Name        = "Lbcpyp_Lambda_CloudWatch_Alarms_Topic"
    Description = "SNS topic for Lambda function error alerts"
  })
}

resource "aws_sns_topic_subscription" "gras_techsupport_email" {
  topic_arn = aws_sns_topic.lambda_error_alerts.arn
  protocol  = "email"
  endpoint  = "gras.techsupport@sonymusic.com"
}

resource "aws_sns_topic" "lambda_error_alerts_cloudops_only" {
  # checkov:skip=CKV_AWS_26:Ensure all data stored in the SNS topic is encrypted
  name = "Lbcpyp_Lambda_CloudWatch_Alarms_Topic_CloudopsOnly"

  tags = merge(var.common_tags, {
    Name        = "Lbcpyp_Lambda_CloudWatch_Alarms_Topic_CloudopsOnly"
    Description = "SNS topic for Lambda function error alerts for Cloudops"
  })
}


