forked from Invicton-Labs/terraform-null-deepmerge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
20 lines (19 loc) · 880 Bytes
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
terraform {
experiments = [variable_validation]
}
variable "maps" {
description = "A list of maps to merge. Maps should be ordered in increasing precedence, i.e. values in a map later in the list will overwrite values in a map earlier in the list."
type = any
validation {
condition = try(tonumber(var.maps), tobool(var.maps), tostring(var.maps), tomap(var.maps), null) == null
error_message = "The `maps` variable must be a list of maps and/or objects. The provided value is not a list."
}
validation {
condition = !can(index([
for mp in var.maps:
try(tolist(mp), toset(mp), tonumber(mp), tobool(mp), tostring(mp), null) == null
]
, false))
error_message = "The `maps` variable must be a list of maps and/or objects. Not all elements meet this requirement."
}
}