Skip to content

Commit fbc4a85

Browse files
committed
Reduce homegrown backup policy and add AWS managed ones
1 parent 4564771 commit fbc4a85

File tree

1 file changed

+11
-52
lines changed

1 file changed

+11
-52
lines changed

backups/backup_plan.tf

Lines changed: 11 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,58 +42,7 @@ resource "aws_iam_role_policy" "backup_role_policy" {
4242
Statement = [
4343
{
4444
Action = [
45-
"tag:getResources",
46-
]
47-
Effect = "Allow"
48-
Resource = "*"
49-
},
50-
{
51-
Action = [
52-
"rds:DescribeDBInstances",
53-
"rds:DescribeDBClusters",
54-
"rds:ListTagsForResource",
55-
"rds:CreateDBSnapshot",
56-
"rds:DeleteDBSnapshot",
57-
"rds:CopyDBSnapshot",
58-
"rds:DescribeDBSnapshots",
59-
"rds:AddTagsToResource"
60-
]
61-
Effect = "Allow"
62-
Resource = "*"
63-
},
64-
{
65-
Action = [
66-
"s3:GetBucketNotification",
67-
"s3:GetBucketLocation",
68-
"s3:ListBucket",
69-
"s3:GetBucketTagging",
70-
"s3:GetBucketVersioning",
71-
"s3:GetBucketPublicAccessBlock",
72-
"s3:GetBucketAcl",
73-
"s3:GetBucketPolicy",
74-
"s3:GetObject",
75-
"s3:GetObjectVersion",
76-
"s3:GetObjectTagging",
77-
"s3:GetObjectAcl",
78-
"s3:PutBucketNotification",
79-
"s3:ListBucketVersions",
80-
"events:ListRules",
81-
"events:PutRule",
82-
"events:ListTargetsByRule",
83-
"events:PutTargets",
84-
"events:RemoveTargets",
85-
"events:DeleteRule",
86-
"cloudwatch:GetMetricData"
87-
]
88-
Effect = "Allow"
89-
Resource = "*"
90-
},
91-
{
92-
Action = [
93-
"elasticfilesystem:DescribeFileSystems",
94-
"elasticfilesystem:DescribeBackupPolicy",
95-
"elasticfilesystem:Backup",
96-
"elasticfilesystem:DescribeTags"
45+
"elasticfilesystem:DescribeBackupPolicy"
9746
]
9847
Effect = "Allow"
9948
Resource = "*"
@@ -107,6 +56,16 @@ resource "aws_iam_role_policy_attachment" "backup_role_managed_s3_policy" {
10756
role = aws_iam_role.backup_role.name
10857
}
10958

59+
resource "aws_iam_role_policy_attachment" "backup_role_service_linked_backup" {
60+
policy_arn = "arn:aws:iam::aws:policy/aws-service-role/AWSBackupServiceLinkedRolePolicyForBackup"
61+
role = aws_iam_role.backup_role.name
62+
}
63+
64+
resource "aws_iam_role_policy_attachment" "backup_role_service_backup" {
65+
policy_arn = "arn:aws:iam::aws:policy/aws-service-role/AWSBackupServiceRolePolicyForBackup"
66+
role = aws_iam_role.backup_role.name
67+
}
68+
11069
resource "aws_iam_role_policy_attachment" "backup_role_managed_s3_policy_restore" {
11170
policy_arn = "arn:aws:iam::aws:policy/AWSBackupServiceRolePolicyForS3Restore"
11271
role = aws_iam_role.backup_role.name

0 commit comments

Comments
 (0)