Skip to content

Commit 99337ca

Browse files
authored
Fix RAM share creation when a targetted OU contains inactive accounts (#106)
1 parent 501e134 commit 99337ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/service-deployment/regional.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ data "aws_organizations_organizational_unit_descendant_accounts" "target_account
44
parent_id = each.key
55
}
66

7+
locals {
8+
ram_target_accounts = try(flatten(values(data.aws_organizations_organizational_unit_descendant_accounts.target_accounts)[*].accounts[*]), [])
9+
ram_target_account_ids = [for a in local.ram_target_accounts : a.id if a.state == "ACTIVE"]
10+
}
11+
712
#
813
# Module for deploying AWS Backup resources in a specific region.
914
#
@@ -50,7 +55,7 @@ module "region" {
5055
ram = {
5156
create_lag_shares = local.create_lag_shares
5257
lag_share_name = local.lag_share_name
53-
target_account_ids = try(flatten(values(data.aws_organizations_organizational_unit_descendant_accounts.target_accounts)[*].accounts[*].id), [])
58+
target_account_ids = local.ram_target_account_ids
5459
}
5560
stepfunctions = {
5661
ingest_state_machine_name = local.ingest_state_machine_name

0 commit comments

Comments
 (0)