我将此添加到模块,并且仅当父项目(使用模块)输入一个或一组电子邮件地址时才启用此资源(因此,如果未指定“var.sns_email_subscriber”或没有指定“var.sns_email_subscriber”在父项目中,该资源将不会被启用/使用)。
resource "aws_sns_topic_subscription" "email_target" {
for_each = toset(var.sns_email_subscriber)
topic_arn = aws_sns_topic.sns_topic.arn
protocol = "email"
endpoint = each.value
endpoint_auto_confirms = true
}
var.sns_email_subscriber
是 列表(字符串)
有人可以帮忙吗? 预先感谢。