Skip to content

Commit e6974e7

Browse files
committed
Move Backup Service Role to within each deployment
Moving this role allows us to use it in the Vault Access Policies of the member account vaults, enabling restricted access to copy backups back into member accounts.
1 parent 51580de commit e6974e7

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ module "deployment" {
4646
}
4747
central_account_resource_name_prefix = var.central_account_resource_name_prefix
4848
central_backup_service_linked_role_arn = local.backup_service_linked_role_arn
49-
central_backup_service_role_arn = module.backup_service_role.role.arn
5049
central_deployment_helper_role_arn = module.deployment_helper.lambda_role.arn
5150
central_deployment_helper_topic_name = module.deployment_helper.sns_topic.name
5251
deployment_regions = local.deployment_regions

iam-service-role.tf renamed to modules/service-deployment/iam-service-role.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#
2-
# Creates a service role for AWS Backup.
2+
# Creates a service role for AWS Backup
3+
# One per deployment to restrict permissions for copying back to member accounts
34
#
45

56
module "backup_service_role" {
6-
source = "./modules/iam-role"
7+
source = "../iam-role"
78

8-
name = join("", [var.central_account_resource_name_prefix, "backup-service-role"])
9+
name = join("", [local.central_account_resource_name_prefix, "backup-service-role"])
910
assume_role_policy = jsonencode({
1011
Version : "2012-10-17"
1112
Statement : [
@@ -17,7 +18,7 @@ module "backup_service_role" {
1718
Action : "sts:AssumeRole",
1819
Condition : {
1920
StringEquals : {
20-
"aws:SourceAccount" : local.account_id
21+
"aws:SourceAccount" : var.current.account_id
2122
}
2223
}
2324
}

modules/service-deployment/iam-sfn-backup-ingest.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ module "backup_ingest_sfn_role" {
107107
"Action" : [
108108
"iam:PassRole"
109109
],
110-
"Resource" : var.central_backup_service_role_arn
110+
"Resource" : module.backup_service_role.role.arn
111111
},
112112
{
113113
Sid : "AllowAssumeRoleInMemberAccounts",

modules/service-deployment/regional.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module "region" {
3333
standard_vaults = local.standard_vaults
3434
}
3535
deployment = {
36-
backup_service_role_arn = var.central_backup_service_role_arn
36+
backup_service_role_arn = module.backup_service_role.role.arn
3737
ou_paths_including_children = local.deployment_ou_paths_including_children
3838
}
3939
eventbridge = {

modules/service-deployment/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ variable "backup_tag_key" {
2121
}
2222
}
2323

24-
variable "central_backup_service_role_arn" {
25-
description = "The ARN of the central backup service role, used to copy backups between vaults."
26-
type = string
27-
}
28-
2924
variable "central_backup_service_linked_role_arn" {
3025
description = "The ARN of the AWS Backup service-linked role in the central account. Required to be added to custom KMS Key Policies in member accounts."
3126
type = string

0 commit comments

Comments
 (0)