-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvariables.tf
38 lines (35 loc) · 1.05 KB
/
variables.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
variable "git_repository" {
type = any
default = {}
description = "resource definition, default settings are defined within locals and merged with var settings"
}
locals {
default = {
# resource definition
git_repository = {
name = ""
initialization = {
init_type = "Uninitialized"
source_type = ""
source_url = ""
service_connection_id = ""
}
}
}
# compare and merge custom and default values
git_repository_values = {
for git_repository in keys(var.git_repository) :
git_repository => merge(local.default.git_repository, var.git_repository[git_repository])
}
# merge all custom and default values
git_repository = {
for git_repository in keys(var.git_repository) :
git_repository => merge(
local.git_repository_values[git_repository],
{
for config in ["initialization"] :
config => merge(local.default.git_repository[config], local.git_repository_values[git_repository][config])
}
)
}
}