Skip to content

Commit

Permalink
Merge pull request #6989 from ministryofjustice/LAWS-3906
Browse files Browse the repository at this point in the history
[LAWS-3906] Added vault backup policy for CWA
  • Loading branch information
vladimir-kovalyov authored Jul 8, 2024
2 parents 8043598 + 28f6f9e commit 1876003
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions terraform/environments/contract-work-administration/backups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,49 @@ resource "aws_backup_selection" "cwa" {
value = "yes"
}
}
}

data "aws_iam_policy_document" "cwa_vault" {
statement {
sid = "Allow local account basic permissions to the vault"
effect = "Allow"

principals {
type = "AWS"
identifiers = ["arn:aws:iam::${local.environment_management.account_ids[terraform.workspace]}:root"]
}

actions = [
"backup:DescribeBackupVault",
"backup:PutBackupVaultAccessPolicy",
"backup:DeleteBackupVaultAccessPolicy",
"backup:GetBackupVaultAccessPolicy",
"backup:StartBackupJob",
"backup:GetBackupVaultNotifications",
"backup:PutBackupVaultNotifications",
"backup:StartRestoreJob"
]

resources = [aws_backup_vault.cwa.arn]
}
statement {
sid = "Allow copying of recovery points from Landing Zone"
effect = "Allow"

principals {
type = "AWS"
identifiers = ["arn:aws:iam::411213865113:root"]
}

actions = [
"backup:CopyIntoBackupVault"
]

resources = [aws_backup_vault.cwa.arn]
}
}

resource "aws_backup_vault_policy" "cwa" {
backup_vault_name = aws_backup_vault.cwa.name
policy = data.aws_iam_policy_document.cwa_vault.json
}

0 comments on commit 1876003

Please sign in to comment.