Skip to content

Commit 7220cd4

Browse files
Merge pull request #88 from NHSDigital/CCM-10039_addingBackupTagResourcePerm
CCM-10039 addingBackupTagResourcePerm
2 parents 2eee676 + 161c6d0 commit 7220cd4

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

infrastructure/modules/aws-backup-source/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ No requirements.
6262
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | Default tag map for application to all taggable resources in the module | `map(string)` | `{}` | no |
6363
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the environment where AWS Backup is configured. | `string` | n/a | yes |
6464
| <a name="input_management_ci_role_arn"></a> [management\_ci\_role\_arn](#input\_management\_ci\_role\_arn) | ARN of Terraform role used to deploy to account | `string` | n/a | yes |
65-
| <a name="input_name"></a> [name](#input\_name) | The variable encapsulating the name of this bucket | `string` | n/a | yes |
65+
| <a name="input_name"></a> [name](#input\_name) | The variable encapsulating the name of this bucket | `string` | `"backup"` | no |
6666
| <a name="input_notification_kms_key"></a> [notification\_kms\_key](#input\_notification\_kms\_key) | The ARN of the bootstrap KMS key used for encryption at rest of the SNS topic. | `string` | n/a | yes |
6767
| <a name="input_notifications_target_email_address"></a> [notifications\_target\_email\_address](#input\_notifications\_target\_email\_address) | The email address to which backup notifications will be sent via SNS. | `string` | `""` | no |
6868
| <a name="input_principal_org_id"></a> [principal\_org\_id](#input\_principal\_org\_id) | The AWS Org ID (numeric) | `string` | n/a | yes |

infrastructure/modules/aws-backup-source/iam_role_backup.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,30 @@ 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_role_policy_attachment" "backup_additional" {
41+
role = aws_iam_role.backup.name
42+
policy_arn = aws_iam_policy.backup_additional.arn
43+
}
44+
45+
resource "aws_iam_policy" "backup_additional" {
46+
name = "${local.csi}-backup_additional"
47+
description = "Additional Backup Actions"
48+
policy = data.aws_iam_policy_document.backup_additional.json
49+
}
50+
51+
data "aws_iam_policy_document" "backup_additional" {
52+
statement {
53+
effect = "Allow"
54+
55+
actions = [
56+
"backup:TagResource",
57+
]
58+
59+
#trivy:ignore:aws-iam-no-policy-wildcards
60+
resources = [
61+
"*",
62+
]
63+
}
64+
}

infrastructure/modules/aws-backup-source/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ variable "component" {
1616
variable "name" {
1717
type = string
1818
description = "The variable encapsulating the name of this bucket"
19+
default = "backup"
1920
}
2021

2122
variable "default_tags" {

0 commit comments

Comments
 (0)