Skip to content

Commit a43a5c1

Browse files
committed
feature/PI-407-immutable_backups TEST - all backups permissions
1 parent 70a5598 commit a43a5c1

File tree

4 files changed

+47
-15
lines changed

4 files changed

+47
-15
lines changed

infrastructure/terraform/modules/aws-backup-source/iam.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,26 @@ resource "aws_iam_role_policy_attachment" "s3_backup" {
3535
policy_arn = "arn:aws:iam::aws:policy/AWSBackupServiceRolePolicyForS3Backup"
3636
role = aws_iam_role.backup.name
3737
}
38+
39+
40+
resource "aws_iam_policy" "restore_testing_selection_permissions" {
41+
name = "${local.resource_name_prefix}-source-account-backup-permissions"
42+
policy = jsonencode({
43+
Version = "2012-10-17",
44+
Statement = [
45+
{
46+
Effect = "Allow",
47+
Action = [
48+
"backup:*",
49+
"cloudformation:*"
50+
],
51+
Resource = "*"
52+
}
53+
]
54+
})
55+
}
56+
57+
resource "aws_iam_role_policy_attachment" "source_account_backup_permissions" {
58+
policy_arn = aws_iam_policy.restore_testing_selection_permissions.arn
59+
role = aws_iam_role.backup.name
60+
}

infrastructure/terraform/per_account/dev/aws-backups.tf

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,4 @@ module "source" {
102102
],
103103
"selection_tag" : "NHSE-Enable-Backup"
104104
}
105-
# # Note here that we need to explicitly disable DynamoDB backups in the source account.
106-
# # The default config in the module enables backups for all resource types.
107-
# backup_plan_config_dynamodb = {
108-
# "compliance_resource_types" : [
109-
# "DynamoDB"
110-
# ],
111-
# "rules" : [
112-
# ],
113-
# "enable" : false,
114-
# "selection_tag" : "NHSE-Enable-Backup"
115-
# }
116105
}

infrastructure/terraform/per_account/dev/permissions.tf

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ resource "aws_iam_policy" "source_account_backup_permissions" {
3636
"backup:DeleteRestoreTestingPlan",
3737
"backup:GetRestoreTestingPlan",
3838
"backup:ListRestoreTestingPlans",
39-
"backup:UpdateRestoreTestingPlan"
39+
"backup:UpdateRestoreTestingPlan",
40+
"backup:CreateRestoreTestingSelection",
41+
"backup:DescribeRestoreTestingSelection",
42+
"backup:UpdateRestoreTestingSelection",
43+
"backup:DeleteRestoreTestingSelection",
4044
],
4145
Resource = "*"
4246
},
@@ -59,6 +63,24 @@ resource "aws_iam_policy" "source_account_backup_permissions" {
5963
"kms:TagResource"
6064
],
6165
Resource = "*"
66+
},
67+
{
68+
Effect = "Allow",
69+
Action = [
70+
"secretsmanager:GetSecretValue"
71+
],
72+
Resource = [
73+
"arn:aws:secretsmanager:*:${var.assume_account}:secret:destination_vault_arn-*",
74+
"arn:aws:secretsmanager:*:${var.assume_account}:secret:destination_account_id-*"
75+
]
76+
},
77+
{
78+
Effect = "Allow",
79+
Action = [
80+
"backup:*",
81+
"cloudformation:*"
82+
],
83+
Resource = "*"
6284
}
6385
]
6486
})

scripts/infrastructure/policies/deployment2-policy.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@
169169
"arn:aws:secretsmanager:*:${ACCOUNT_ID}:secret:*-apigee-credentials-*",
170170
"arn:aws:secretsmanager:*:${ACCOUNT_ID}:secret:*-apigee-cpm-apikey-*",
171171
"arn:aws:secretsmanager:*:${ACCOUNT_ID}:secret:*-apigee-app-key-*",
172-
"arn:aws:secretsmanager:*:${ACCOUNT_ID}:secret:*-etl-notify-slack-webhook-url-*",
173-
"arn:aws:secretsmanager:*:${ACCOUNT_ID}:secret:destination_vault_arn-*",
174-
"arn:aws:secretsmanager:*:${ACCOUNT_ID}:secret:destination_account_id-*"
172+
"arn:aws:secretsmanager:*:${ACCOUNT_ID}:secret:*-etl-notify-slack-webhook-url-*"
175173
]
176174
},
177175
{

0 commit comments

Comments
 (0)