Skip to content

Commit 45ee40a

Browse files
committed
Fix variables validation
1 parent b389afa commit 45ee40a

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

modules/alb-route53-alias/variables.tf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,12 @@ variable "alias_weighted_routing" {
1818
default = null
1919

2020
validation {
21-
condition = (
22-
var.alias_weighted_routing == null ||
23-
var.alias_weighted_routing.weight >= 0
24-
)
21+
condition = try(var.alias_weighted_routing.weight >= 0, true)
2522
error_message = "alias_weighted_routing.weight must be greater than or equal to 0."
2623
}
2724

2825
validation {
29-
condition = (
30-
var.alias_weighted_routing == null ||
31-
trimspace(var.alias_weighted_routing.set_identifier) != ""
32-
)
26+
condition = try(trimspace(var.alias_weighted_routing.set_identifier) != "", true)
3327
error_message = "alias_weighted_routing.set_identifier must not be empty."
3428
}
3529
}

variables.tf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,12 @@ variable "alias_weighted_routing" {
3131
default = null
3232

3333
validation {
34-
condition = (
35-
var.alias_weighted_routing == null ||
36-
var.alias_weighted_routing.weight >= 0
37-
)
34+
condition = try(var.alias_weighted_routing.weight >= 0, true)
3835
error_message = "alias_weighted_routing.weight must be greater than or equal to 0."
3936
}
4037

4138
validation {
42-
condition = (
43-
var.alias_weighted_routing == null ||
44-
trimspace(var.alias_weighted_routing.set_identifier) != ""
45-
)
39+
condition = try(trimspace(var.alias_weighted_routing.set_identifier) != "", true)
4640
error_message = "alias_weighted_routing.set_identifier must not be empty."
4741
}
4842
}

0 commit comments

Comments
 (0)