File tree 5 files changed +17
-6
lines changed
integrations/event-bridge
5 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,9 @@ locals {
119
119
120
120
# final targets to deploy organizational resources in
121
121
deployment_targets_ous = lookup (local. deployment_options , local. org_configuration , local. deployment_options . default )
122
+
123
+ // check if root is part of the excluded_ouids
124
+ isRootExcluded = length (local. root_org_unit ) > 0 ? contains (var. exclude_ouids , local. root_org_unit [0 ]) : false
122
125
}
123
126
124
127
# -----------------------------------------------------------------
@@ -127,7 +130,7 @@ locals {
127
130
128
131
# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
129
132
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
130
- for_each = local. org_configuration == " excluded_ous_only" && ! contains (var . exclude_ouids , local. root_org_unit [ 0 ]) ? var. exclude_ouids : []
133
+ for_each = local. org_configuration == " excluded_ous_only" && ! local. isRootExcluded ? var. exclude_ouids : []
131
134
parent_id = each. key
132
135
}
133
136
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ locals {
119
119
120
120
# final targets to deploy organizational resources in
121
121
deployment_targets_ous = lookup (local. deployment_options , local. org_configuration , local. deployment_options . default )
122
+
123
+ exclude_root_ou = length (local. root_org_unit ) > 0 ? contains (var. exclude_ouids , local. root_org_unit [0 ]) : false
122
124
}
123
125
124
126
# -----------------------------------------------------------------
@@ -127,10 +129,9 @@ locals {
127
129
128
130
# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
129
131
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
130
- for_each = local. org_configuration == " excluded_ous_only" && ! contains (var . exclude_ouids , local. root_org_unit [ 0 ]) ? var. exclude_ouids : []
132
+ for_each = local. org_configuration == " excluded_ous_only" && ! local. exclude_root_ou ? var. exclude_ouids : []
131
133
parent_id = each. key
132
134
}
133
-
134
135
locals {
135
136
# ACCOUNTS CONFIGURATION (determine user provided accounts configuration)
136
137
accounts_configuration = (
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ locals {
119
119
120
120
# final targets to deploy organizational resources in
121
121
deployment_targets_ous = lookup (local. deployment_options , local. org_configuration , local. deployment_options . default )
122
+
123
+ exclude_root_ou = length (local. root_org_unit ) > 0 ? contains (var. exclude_ouids , local. root_org_unit [0 ]) : false
122
124
}
123
125
124
126
# -----------------------------------------------------------------
@@ -127,7 +129,7 @@ locals {
127
129
128
130
# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
129
131
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
130
- for_each = local. org_configuration == " excluded_ous_only" && ! contains (var . exclude_ouids , local. root_org_unit [ 0 ]) ? var. exclude_ouids : []
132
+ for_each = local. org_configuration == " excluded_ous_only" && ! local. exclude_root_ou ? var. exclude_ouids : []
131
133
parent_id = each. key
132
134
}
133
135
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ locals {
119
119
120
120
# final targets to deploy organizational resources in
121
121
deployment_targets_ous = lookup (local. deployment_options , local. org_configuration , local. deployment_options . default )
122
+
123
+ exclude_root_ou = length (local. root_org_unit ) > 0 ? contains (var. exclude_ouids , local. root_org_unit [0 ]) : false
122
124
}
123
125
124
126
# -----------------------------------------------------------------
@@ -127,7 +129,7 @@ locals {
127
129
128
130
# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
129
131
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
130
- for_each = local. org_configuration == " excluded_ous_only" && ! contains (var . exclude_ouids , local. root_org_unit [ 0 ]) ? var. exclude_ouids : []
132
+ for_each = local. org_configuration == " excluded_ous_only" && ! local. exclude_root_ou ? var. exclude_ouids : []
131
133
parent_id = each. key
132
134
}
133
135
Original file line number Diff line number Diff line change @@ -133,6 +133,9 @@ locals {
133
133
134
134
# final targets to deploy organizational resources in
135
135
deployment_targets_ous = lookup (local. deployment_options , local. org_configuration , local. deployment_options . default )
136
+
137
+ // check if root is part of the excluded_ouids
138
+ isRootExcluded = length (local. root_org_unit ) > 0 ? contains (var. exclude_ouids , local. root_org_unit [0 ]) : false
136
139
}
137
140
138
141
# -----------------------------------------------------------------
@@ -141,7 +144,7 @@ locals {
141
144
142
145
# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
143
146
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
144
- for_each = local. org_configuration == " excluded_ous_only" && ! contains (var . exclude_ouids , local. root_org_unit [ 0 ]) ? var. exclude_ouids : []
147
+ for_each = local. org_configuration == " excluded_ous_only" && ! local. isRootExcluded ? var. exclude_ouids : []
145
148
parent_id = each. key
146
149
}
147
150
You can’t perform that action at this time.
0 commit comments