File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
terraform/account-wide-infrastructure/modules/backup-source Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11resource "aws_sns_topic" "backup" {
22 name = " ${ local . resource_name_prefix } -notifications"
33 kms_master_key_id = var. bootstrap_kms_key_arn
4- policy = data. aws_iam_policy_document . allow_backup_to_sns . json
54}
65
76data "aws_iam_policy_document" "allow_backup_to_sns" {
@@ -19,12 +18,25 @@ data "aws_iam_policy_document" "allow_backup_to_sns" {
1918 identifiers = [" backup.amazonaws.com" ]
2019 }
2120
22- resources = [" *" ]
21+ resources = [
22+ aws_sns_topic . backup . arn
23+ ]
2324
2425 sid = " allow_backup"
26+
27+ condition {
28+ test = " StringEquals"
29+ variable = " aws:SourceAccount"
30+ values = [" ${ data . aws_caller_identity . current . account_id } " ]
31+ }
2532 }
2633}
2734
35+ resource "aws_sns_topic_policy" "backup_sns_policy" {
36+ arn = aws_sns_topic. backup . arn
37+ policy = data. aws_iam_policy_document . allow_backup_to_sns . json
38+ }
39+
2840resource "aws_sns_topic_subscription" "aws_backup_notifications_email_target" {
2941 count = length (var. notification_target_email_addresses )
3042 topic_arn = aws_sns_topic. backup . arn
You can’t perform that action at this time.
0 commit comments