File tree Expand file tree Collapse file tree 5 files changed +17
-6
lines changed 
integrations/event-bridge Expand file tree Collapse file tree 5 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,9 @@ locals {
119119
120120  #  final targets to deploy organizational resources in
121121  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 
122125}
123126
124127# -----------------------------------------------------------------
@@ -127,7 +130,7 @@ locals {
127130
128131#  if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
129132data  "aws_organizations_organizational_unit_descendant_accounts"  "ou_accounts_to_exclude"  {
130-   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! contains (var . exclude_ouids ,  local. root_org_unit [ 0 ])  ?  var. exclude_ouids  :  []
133+   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! local. isRootExcluded  ?  var. exclude_ouids  :  []
131134  parent_id  =  . key 
132135}
133136
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ locals {
119119
120120  #  final targets to deploy organizational resources in
121121  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 
122124}
123125
124126# -----------------------------------------------------------------
@@ -127,10 +129,9 @@ locals {
127129
128130#  if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
129131data  "aws_organizations_organizational_unit_descendant_accounts"  "ou_accounts_to_exclude"  {
130-   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! contains (var . exclude_ouids ,  local. root_org_unit [ 0 ])  ?  var. exclude_ouids  :  []
132+   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! local. exclude_root_ou  ?  var. exclude_ouids  :  []
131133  parent_id  =  . key 
132134}
133- 
134135locals  {
135136  #  ACCOUNTS CONFIGURATION (determine user provided accounts configuration)
136137  accounts_configuration  =  
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ locals {
119119
120120  #  final targets to deploy organizational resources in
121121  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 
122124}
123125
124126# -----------------------------------------------------------------
@@ -127,7 +129,7 @@ locals {
127129
128130#  if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
129131data  "aws_organizations_organizational_unit_descendant_accounts"  "ou_accounts_to_exclude"  {
130-   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! contains (var . exclude_ouids ,  local. root_org_unit [ 0 ])  ?  var. exclude_ouids  :  []
132+   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! local. exclude_root_ou  ?  var. exclude_ouids  :  []
131133  parent_id  =  . key 
132134}
133135
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ locals {
119119
120120  #  final targets to deploy organizational resources in
121121  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 
122124}
123125
124126# -----------------------------------------------------------------
@@ -127,7 +129,7 @@ locals {
127129
128130#  if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
129131data  "aws_organizations_organizational_unit_descendant_accounts"  "ou_accounts_to_exclude"  {
130-   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! contains (var . exclude_ouids ,  local. root_org_unit [ 0 ])  ?  var. exclude_ouids  :  []
132+   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! local. exclude_root_ou  ?  var. exclude_ouids  :  []
131133  parent_id  =  . key 
132134}
133135
Original file line number Diff line number Diff line change @@ -133,6 +133,9 @@ locals {
133133
134134  #  final targets to deploy organizational resources in
135135  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 
136139}
137140
138141# -----------------------------------------------------------------
@@ -141,7 +144,7 @@ locals {
141144
142145#  if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
143146data  "aws_organizations_organizational_unit_descendant_accounts"  "ou_accounts_to_exclude"  {
144-   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! contains (var . exclude_ouids ,  local. root_org_unit [ 0 ])  ?  var. exclude_ouids  :  []
147+   for_each   =  . org_configuration  ==  " excluded_ous_only" &&  ! local. isRootExcluded  ?  var. exclude_ouids  :  []
145148  parent_id  =  . key 
146149}
147150
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments