【发布时间】:2017-12-12 23:38:45
【问题描述】:
我正在尝试为 aws_s3_bucket_notification 编写一个灵活/动态的资源,它可能具有指定 s3 存储桶的可变主题。对于一个桶,我可能只有 2 个前缀和 2 个主题,而对于其他 4 或 5 个等等......我正在考虑使用一个映射函数,它将存储每个前缀类型的“前缀”和“SNS ARN”为事件将是相同的。我需要创建一个 s3_bucket_notification,其中包含所有主题,而无需手动编写每个主题。有什么建议吗?
例子
resource "aws_s3_bucket_notification" "bucket_notification" {
bucket = "${aws_s3_bucket.bucket.id}"
topic {
topic_arn = "$map.value" ###prototype
events = ["s3:ObjectCreated:*"]
filter_suffix = "$map.key" ###prototype
}
}
【问题讨论】:
-
使用原始循环之类的东西