Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modules/agentless-scanning/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ locals {

# final targets to deploy organizational resources in
deployment_targets_ous = lookup(local.deployment_options, local.org_configuration, local.deployment_options.default)

// check if root is part of the excluded_ouids
isRootExcluded = length(local.root_org_unit) > 0 ? contains(var.exclude_ouids, local.root_org_unit[0]) : false
}

#-----------------------------------------------------------------
Expand All @@ -127,7 +130,7 @@ locals {

# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
for_each = local.org_configuration == "excluded_ous_only" && !contains(var.exclude_ouids, local.root_org_unit[0]) ? var.exclude_ouids : []
for_each = local.org_configuration == "excluded_ous_only" && !local.isRootExcluded ? var.exclude_ouids : []
parent_id = each.key
}

Expand Down
5 changes: 3 additions & 2 deletions modules/config-posture/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ locals {

# final targets to deploy organizational resources in
deployment_targets_ous = lookup(local.deployment_options, local.org_configuration, local.deployment_options.default)

exclude_root_ou = length(local.root_org_unit) > 0 ? contains(var.exclude_ouids, local.root_org_unit[0]) : false
}

#-----------------------------------------------------------------
Expand All @@ -127,10 +129,9 @@ locals {

# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
for_each = local.org_configuration == "excluded_ous_only" && !contains(var.exclude_ouids, local.root_org_unit[0]) ? var.exclude_ouids : []
for_each = local.org_configuration == "excluded_ous_only" && !local.exclude_root_ou ? var.exclude_ouids : []
parent_id = each.key
}

locals {
# ACCOUNTS CONFIGURATION (determine user provided accounts configuration)
accounts_configuration = (
Expand Down
4 changes: 3 additions & 1 deletion modules/integrations/event-bridge/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ locals {

# final targets to deploy organizational resources in
deployment_targets_ous = lookup(local.deployment_options, local.org_configuration, local.deployment_options.default)

exclude_root_ou = length(local.root_org_unit) > 0 ? contains(var.exclude_ouids, local.root_org_unit[0]) : false
}

#-----------------------------------------------------------------
Expand All @@ -127,7 +129,7 @@ locals {

# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
for_each = local.org_configuration == "excluded_ous_only" && !contains(var.exclude_ouids, local.root_org_unit[0]) ? var.exclude_ouids : []
for_each = local.org_configuration == "excluded_ous_only" && !local.exclude_root_ou ? var.exclude_ouids : []
parent_id = each.key
}

Expand Down
4 changes: 3 additions & 1 deletion modules/onboarding/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ locals {

# final targets to deploy organizational resources in
deployment_targets_ous = lookup(local.deployment_options, local.org_configuration, local.deployment_options.default)

exclude_root_ou = length(local.root_org_unit) > 0 ? contains(var.exclude_ouids, local.root_org_unit[0]) : false
}

#-----------------------------------------------------------------
Expand All @@ -127,7 +129,7 @@ locals {

# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
for_each = local.org_configuration == "excluded_ous_only" && !contains(var.exclude_ouids, local.root_org_unit[0]) ? var.exclude_ouids : []
for_each = local.org_configuration == "excluded_ous_only" && !local.exclude_root_ou ? var.exclude_ouids : []
parent_id = each.key
}

Expand Down
5 changes: 4 additions & 1 deletion modules/vm-workload-scanning/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ locals {

# final targets to deploy organizational resources in
deployment_targets_ous = lookup(local.deployment_options, local.org_configuration, local.deployment_options.default)

// check if root is part of the excluded_ouids
isRootExcluded = length(local.root_org_unit) > 0 ? contains(var.exclude_ouids, local.root_org_unit[0]) : false
}

#-----------------------------------------------------------------
Expand All @@ -141,7 +144,7 @@ locals {

# if only exclude_ouids are provided and as long as it isn't Root OU, fetch all their child accounts to filter exclusions
data "aws_organizations_organizational_unit_descendant_accounts" "ou_accounts_to_exclude" {
for_each = local.org_configuration == "excluded_ous_only" && !contains(var.exclude_ouids, local.root_org_unit[0]) ? var.exclude_ouids : []
for_each = local.org_configuration == "excluded_ous_only" && !local.isRootExcluded ? var.exclude_ouids : []
parent_id = each.key
}

Expand Down