generated from netascode/terraform-nxos-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
113 lines (98 loc) · 4.06 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
variable "device" {
description = "A device name from the provider configuration."
type = string
default = null
}
variable "name" {
description = "VRF Name."
type = string
validation {
condition = can(regex("^[a-zA-Z0-9_.-]{0,32}$", var.name))
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `_`, `.`, `-`. Maximum characters: 32."
}
}
variable "description" {
description = "VRF description."
type = string
default = ""
validation {
condition = can(regex("^.{0,254}$", var.description))
error_message = "Maximum characters: `254`."
}
}
variable "vni" {
description = "VRF Virtual Network Identifier."
type = number
default = null
validation {
condition = var.vni == null || try(var.vni >= 1 && var.vni <= 16777214, false)
error_message = "Minimum value: `1`. Maximum value: `16777214`."
}
}
variable "route_distinguisher" {
description = "VRF Route Distinguisher. Allowed formats: `auto`, `1.1.1.1:1`, `65535:1`."
type = string
default = null
validation {
condition = var.route_distinguisher == null || var.route_distinguisher == "auto" || can(regex("\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+", var.route_distinguisher)) || can(regex("\\d+:\\d+", var.route_distinguisher))
error_message = "Allowed formats: `auto`, `1.1.1.1:1`, `65535:1`."
}
}
variable "address_families" {
description = <<EOT
VRF Address Families List.
Choices `address_family`: `ipv4_unicast`, `ipv6_unicast`.
Allowed formats `route_target_import`: `auto`, `1.1.1.1:1`, `65535:1`."
Allowed formats `route_target_export`: `auto`, `1.1.1.1:1`, `65535:1`."
Allowed formats `route_target_import_evpn`: `auto`, `1.1.1.1:1`, `65535:1`."
Allowed formats `route_target_export_evpn`: `auto`, `1.1.1.1:1`, `65535:1`."
EOT
type = list(object({
address_family = string
route_target_both_auto = optional(bool, false)
route_target_both_auto_evpn = optional(bool, false)
route_target_import = optional(list(string), [])
route_target_export = optional(list(string), [])
route_target_import_evpn = optional(list(string), [])
route_target_export_evpn = optional(list(string), [])
}))
default = []
validation {
condition = alltrue([
for v in var.address_families : contains(["ipv4_unicast", "ipv6_unicast"], v.address_family)
])
error_message = "`address_family`: Allowed values are: `ipv4_unicast` or `ipv6_unicast`."
}
validation {
condition = alltrue(flatten([
for v in var.address_families : v.route_target_import == null ? [true] : [
for entry in v.route_target_import : entry == "auto" || can(regex("\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+", entry)) || can(regex("\\d+:\\d+", entry))
]
]))
error_message = "`route_target_import`: Allowed formats: `auto`, `1.1.1.1:1`, `65535:1`."
}
validation {
condition = alltrue(flatten([
for v in var.address_families : v.route_target_export == null ? [true] : [
for entry in v.route_target_export : entry == "auto" || can(regex("\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+", entry)) || can(regex("\\d+:\\d+", entry))
]
]))
error_message = "`route_target_export`: Allowed formats: `auto`, `1.1.1.1:1`, `65535:1`."
}
validation {
condition = alltrue(flatten([
for v in var.address_families : v.route_target_import_evpn == null ? [true] : [
for entry in v.route_target_import_evpn : entry == "auto" || can(regex("\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+", entry)) || can(regex("\\d+:\\d+", entry))
]
]))
error_message = "`route_target_import_evpn`: Allowed formats: `auto`, `1.1.1.1:1`, `65535:1`."
}
validation {
condition = alltrue(flatten([
for v in var.address_families : v.route_target_export_evpn == null ? [true] : [
for entry in v.route_target_export_evpn : entry == "auto" || can(regex("\\d+\\.\\d+\\.\\d+\\.\\d+:\\d+", entry)) || can(regex("\\d+:\\d+", entry))
]
]))
error_message = "`route_target_export_evpn`: Allowed formats: `auto`, `1.1.1.1:1`, `65535:1`."
}
}