-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
30 lines (27 loc) · 1.04 KB
/
main.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
27
28
29
30
locals {
locations_data = jsondecode(file("${path.module}/locations.json"))
locations_name = {
for location in local.locations_data.locations : location.name => {
name = location.name
display_name = location.displayName
short_name = location.shortName
regional_display_name = location.regionalDisplayName
paired_region_name = location.pairedRegionName
}
}
locations_display_name = {
for location in local.locations_data.locations : location.displayName => {
name = location.name
display_name = location.displayName
short_name = location.shortName
regional_display_name = location.regionalDisplayName
paired_region_name = location.pairedRegionName
}
}
lookup_name = lookup(local.locations_name, var.location, null)
lookup_display_name = lookup(local.locations_display_name, var.location, null)
location = try(coalesce(
local.lookup_name,
local.lookup_display_name
), "none")
}