-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SNS Notifications to Backup Vault (#10)
* Add SNS Notifications to Backup Vault * Revert "Cleanup (#7)" This reverts commit d0b5baf. * Update examples * Change policy documents from json to data sources * Cleanup IAM policies to be China friendly * Use a bool for creating sns topic * Fix conditions + move data sources to data.tf
- Loading branch information
Abdul Wahid
authored
Apr 27, 2021
1 parent
b124d74
commit 976339d
Showing
13 changed files
with
357 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
data "aws_region" "current" {} | ||
data "aws_partition" "current" {} | ||
|
||
data "aws_iam_policy_document" "sns_policy" { | ||
count = var.enable_sns_notifications ? 1 : 0 | ||
|
||
statement { | ||
sid = "AllowSNSPublish" | ||
|
||
actions = [ | ||
"SNS:Publish", | ||
] | ||
|
||
effect = "Allow" | ||
|
||
principals { | ||
type = "Service" | ||
identifiers = [ | ||
"backup.amazonaws.com" | ||
] | ||
} | ||
|
||
resources = var.create_sns_topic ? [aws_sns_topic.main[0].arn] : [var.sns_topic_arn] | ||
} | ||
} | ||
|
||
data "aws_iam_policy_document" "main" { | ||
statement { | ||
sid = "AllowBackupService" | ||
|
||
actions = [ | ||
"sts:AssumeRole", | ||
] | ||
|
||
effect = "Allow" | ||
|
||
principals { | ||
type = "Service" | ||
identifiers = [ | ||
"backup.amazonaws.com" | ||
] | ||
} | ||
} | ||
} | ||
|
||
data "aws_iam_policy_document" "main_custom_policy" { | ||
statement { | ||
sid = "AllowTaggingResources" | ||
|
||
actions = [ | ||
"backup:TagResource", | ||
"backup:ListTags", | ||
"backup:UntagResource", | ||
"tag:GetResources" | ||
] | ||
|
||
resources = ["*"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.