-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlocals.tf
52 lines (51 loc) · 1.18 KB
/
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
46
47
48
49
50
51
52
locals {
user_configs = flatten([
for database, config in local.databases : [
for user in config.users : {
database = database
user = user
}
]
])
db_configs = flatten([
for database, config in local.databases : [
for db in config.dbs : {
database = database
db = db
}
]
])
acl_configs = flatten([
for database, config in local.databases : [
for acl in config.acls : {
database = database
rule = acl
}
]
])
acls_by_database = {
for index, config in local.acl_configs :
"${config.database}_${index}" => config
}
user_by_database = {
for config in local.user_configs :
"${config.database}_${config.user.username}" => config
}
dbs_by_database = {
for config in local.db_configs :
"${config.database}_${config.db}" => config
}
default_database = {
name = "default"
node_type = "DB-DEV-S"
users = []
settings = {}
acls = []
dbs = []
private_network = {}
}
databases = {
for database_name, config in var.databases :
database_name => merge(local.default_database, config)
}
}