Skip to content

Commit d7f6acf

Browse files
committed
fix: resolving the issue on the accounts
1 parent 0763711 commit d7f6acf

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

locals.tf

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ locals {
1616
]
1717
])
1818

19+
## All the account deployments to be created
20+
account_deployments = {
21+
for region in local.enabled_regions : region => var.accounts
22+
}
23+
24+
## All the organizational deployment by key
1925
organizational_deployments = { for x in local.organization_unit_deployments : x.key => x }
2026
}
2127

main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ resource "aws_cloudformation_stack_set_instance" "ou" {
5252

5353
## Deploy the stackset to the following accounts
5454
resource "aws_cloudformation_stack_set_instance" "accounts" {
55-
for_each = var.accounts != null ? toset(var.accounts) : toset([])
55+
for_each = local.account_deployments
5656

5757
call_as = var.call_as
58-
region = each.value.region
58+
region = each.key
5959
stack_set_name = aws_cloudformation_stack_set.stackset.name
6060

6161
deployment_targets {
62-
accounts = var.accounts
62+
accounts = each.value
6363
}
6464

6565
depends_on = [

0 commit comments

Comments
 (0)