-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvariables.tf
279 lines (238 loc) · 6.97 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
variable "cloud_projects" {
type = map(string)
}
# spine-leaf-openstack module
variable "ipmi" {
description = "ipmi network informations (same for all regions)"
type = object({
cidr_prefix = string
cidr_newbits = number
})
}
variable "available_region" {
description = "available region which who peering"
type = map(object({
offset = number
ASN = number
}))
validation {
condition = (
length(var.available_region) == length(distinct([for region in keys(var.available_region) : var.available_region[region].offset]))
)
error_message = "Regions offset have to be unique"
}
validation {
condition = (
length(var.available_region) == length(distinct([for region in keys(var.available_region) : var.available_region[region].ASN]))
)
error_message = "Regions ASN have to be unique"
}
}
variable "backbone" {
description = "backbone network informations (same for all regions)"
type = object({
name = string
leafs = object({
loopback = object({
cidr_prefix = string
cidr_region_newbits = number
})
ibgp = object({
cidr_prefix = string
cidr_newbits = number
})
ebgp = object({
cidr_prefix = string
cidr_newbits = number
cidr_bgp_session_newbits = number
})
internet = object({
cidr_prefix = string
cidr_newbits = number
})
})
spine = object({
loopback = object({
cidr_prefix = string
cidr_region_newbits = number
})
})
})
}
# spine-openstack module
variable "vyos_image_name" {
description = "QEMU vyos image name"
type = string
validation {
condition = contains(["vyos-1.3.4-cloud-init"], var.vyos_image_name)
error_message = "Allowed images for vyos are \"vyos-1.3.4-cloud-init\"."
}
}
# spine-vyos module
variable "bgp_as_spines" {
description = "BGP AS number for spines"
type = number
validation {
condition = 64512 <= var.bgp_as_spines && var.bgp_as_spines <= 65535
error_message = "BGP spines AS should be in BGP private range [64512-65535]"
}
}
# leaf-openstack module
# leaf-vyos module
variable "tenant_network" {
description = "list of network / subnet tenants names, cidr_newbits permit to split network in subnets per regions"
type = map(object({
cidr = string
cidr_newbits = number
}))
}
variable "leafs_additionnal_tenant_peers" {
description = "Custom additionnal peering on leaf from tenant network"
type = map(
map(object({
route = list(string)
remote-as = number
tenant_network = string
}))
)
// validation {
// condition = (
// length([for ip in keys(var.leafs_additionnal_tenant_peers) : ip if can(cidrnetmask(format("%s/32", ip)))]) == length(var.leafs_additionnal_tenant_peers)
// )
// error_message = "Keys should be bgp peer ip address"
// }
// validation {
// condition = (
// length([for as in [for peer in var.leafs_additionnal_tenant_peers : peer.remote-as] : as if(64512 <= as && as <= 65535)]) == length(var.leafs_additionnal_tenant_peers)
// )
// error_message = "BGP spines AS should be in BGP private range [64512-65535]"
// }
//validation {
// condition = (
// length([for ntwk in [for peer in var.leafs_additionnal_tenant_peers : peer.tenant_network] : ntwk if contains(keys(var.tenant_network), ntwk)]) == length(var.leafs_additionnal_tenant_peers)
// )
// error_message = "tenant_network not configured"
//}
}
# vyos credentials
variable "vyos_username" {
description = "vyos admin username"
type = string
}
variable "vyos_password_gra9_leaf_1" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_gra9_leaf_1" {
description = "vyos api key https"
type = string
}
variable "vyos_password_gra9_leaf_2" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_gra9_leaf_2" {
description = "vyos api key https"
type = string
}
variable "vyos_password_gra9_spine_1" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_gra9_spine_1" {
description = "vyos api key https"
type = string
}
variable "vyos_password_gra11_leaf_1" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_gra11_leaf_1" {
description = "vyos api key https"
type = string
}
variable "vyos_password_gra11_leaf_2" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_gra11_leaf_2" {
description = "vyos api key https"
type = string
}
variable "vyos_password_gra11_spine_1" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_gra11_spine_1" {
description = "vyos api key https"
type = string
}
variable "vyos_password_sbg5_leaf_1" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_sbg5_leaf_1" {
description = "vyos api key https"
type = string
}
variable "vyos_password_sbg5_leaf_2" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_sbg5_leaf_2" {
description = "vyos api key https"
type = string
}
variable "vyos_password_sbg5_spine_1" {
description = "vyos password admin"
type = string
}
variable "vyos_api_key_sbg5_spine_1" {
description = "vyos api key https"
type = string
}
# Openstack Auth variables
variable "openstack_username_pc1" {
description = "Openstack username (horizon) OS_USERNAME for project PC1"
type = string
}
variable "openstack_password_pc1" {
description = "Openstack password (horizon) OS_PASSWORD for project PC1"
type = string
}
variable "openstack_username_pc2" {
description = "Openstack username (horizon) OS_USERNAME for project PC2"
type = string
}
variable "openstack_password_pc2" {
description = "Openstack password (horizon) OS_PASSWORD for project PC2"
type = string
}
variable "openstack_auth_url" {
description = "Openstack auth url OS_AUTH_URL"
type = string
default = "https://auth.cloud.ovh.net/v3/"
}
variable "openstack_project_domain_name" {
description = "Openstack project domain name OS_PROJECT_DOMAIN_NAME"
type = string
default = "default"
}
variable "openstack_user_domain_name" {
description = "Openstack user domain name OS_USER_DOMAIN_NAME"
type = string
default = "Default"
}
# OVH auth variables
variable "ovh_application_key" {
description = "OVH application key OVH_APPLICATION_KEY aka TF_VAR_ovh_application_key"
type = string
}
variable "ovh_application_secret" {
description = "OVH application secret OVH_APPLICATION_SECRET aka TF_VAR_ovh_application_secret"
type = string
}
variable "ovh_consumer_key" {
description = "OVH consumer key OVH_CONSUMER_KEY aka TF_VAR_ovh_consumer_key"
type = string
}