generated from appvia/terraform-aws-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.tf
27 lines (22 loc) · 857 Bytes
/
locals.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
locals {
## The current region we are provisioning resources in
region = coalesce(var.region, data.aws_region.current.name)
## Enabled regions to deploy the stackset to
enabled_regions = var.enabled_regions == null ? [local.region] : sort(var.enabled_regions)
## Deployments to be created
organization_unit_deployments = flatten([
for region in local.enabled_regions : [
for unit in var.organizational_units : {
key = "${region}_${unit}"
region = region
organization_unit = unit
}
]
])
## All the account deployments to be created
account_deployments = {
for region in local.enabled_regions : region => var.accounts
}
## All the organizational deployment by key
organizational_deployments = { for x in local.organization_unit_deployments : x.key => x }
}