generated from particuleio/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
locals.tf
45 lines (42 loc) · 1012 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
locals {
default_loadbalancer = {
type = "LB-S"
tags = []
backends = []
frontends = []
create_ip = true
ip = {}
certificates = []
}
loadbalancers = {
for name, config in var.loadbalancers :
name => merge(local.default_loadbalancer, config)
}
backends = flatten([
for name, config in local.loadbalancers : [
for backend in config.backends : {
name = backend.name
loadbalancer = name
config = backend
}
]
])
frontends = flatten([
for name, config in local.loadbalancers : [
for frontend in config.frontends : {
name = frontend.name
loadbalancer = name
config = frontend
}
]
])
certificates = flatten([
for name, config in local.loadbalancers : [
for certificate in config.certificates : {
name = certificate.name
loadbalancer = name
config = certificate
}
]
])
}