-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroups.tf
34 lines (31 loc) · 967 Bytes
/
groups.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
resource "gitlab_group" "this" {
for_each = var.groups
parent_id = local.org_id
path = each.value.path
name = each.value.name
description = each.value.desc
visibility_level = "private"
}
resource "gitlab_group_variable" "this" {
for_each = {
for item in flatten([
for key, val in var.groups : [
for xkey, xval in val.variables : {
key = "${key}_${xkey}"
value = {
group = key
xkey = xkey
xval = xval
}
}
]
]) : item.key => item.value
}
group = gitlab_group.this[each.value.group].id
environment_scope = coalesce(each.value.xval.scope, "*")
key = each.value.xkey
value = each.value.xval.value
masked = can(regex("\\A\\w{8,}\\z", each.value.xval.value))
protected = each.value.xval.scope != null
variable_type = each.value.xval.type
}