-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvariables.tf
106 lines (88 loc) · 2.44 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
variable "vc_host" {
description = "vCenter hostname or IP"
type = string
}
variable "vc_user" {
description = "vCenter Admin Username"
type = string
}
variable "vc_pass" {
description = "vCenter Admin Password"
type = string
sensitive = true
}
variable "esxi_host" {
description = "ESXi host on which to perform actions"
type = string
}
variable "dc" {
description = "The Datacenter in vCenter where objects will be created"
type = string
}
variable "datastore" {
description = "The datastore in vSphere where objects will be created"
type = string
default = "datastore1"
}
variable "cluster" {
description = "The vSphere Cluster to place resources"
type = string
}
variable "folder" {
description = "The vSphere folder where VMs will be created"
type = string
}
variable "mgmt_port_group" {
type = string
}
variable "nexus_switch_ova" {
type = string
}
variable "router_template" {
type = string
}
variable "server_template" {
type = string
}
variable "n9ks" {
type = list(object({
name = string
console_telnet_port = string
interfaces = map(string)
}))
validation {
condition = alltrue(flatten([
for dev in var.n9ks : [
for int_key, int in dev.interfaces : substr(int, 0, 7) == "access-" ? true : (substr(int, 0, 6) == "trunk-" ? true : false) if int != null
]
]))
error_message = "Nexus 9K interface values must begin with one of: 'access-' or 'trunk-' or be set to null."
}
}
variable "routers" {
type = list(object({
name = string
console_telnet_port = string
interfaces = map(string)
}))
validation {
condition = alltrue(flatten([
for dev in var.routers : [
for int_key, int in dev.interfaces : substr(int, 0, 7) == "access-" ? true : (substr(int, 0, 6) == "trunk-" ? true : false) if int != null
]
]))
error_message = "Router interface values must begin with one of: 'access-' or 'trunk-' or be set to null."
}
}
variable "servers" {
type = list(map(string))
validation {
condition = alltrue([
for dev in var.servers : substr(dev.eth0, 0, 7) == "access-" ? true : (substr(dev.eth0, 0, 6) == "trunk-" ? true : false) if dev.eth0 != null
])
error_message = "Server interface value must begin with one of: 'access-' or 'trunk-' or be set to null."
}
}
variable "securecrt_path" {
type = string
}