This repository has been archived by the owner on Aug 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bluedata_infra_outputs.tf
326 lines (289 loc) · 10 KB
/
bluedata_infra_outputs.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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# outputs
# Using workaround for getting public IPs, it cannot be read before attaching to an online VM
# https://github.com/terraform-providers/terraform-provider-azurerm/issues/764#issuecomment-365019882
## From AWS scripts
output "project_dir" {
value = abspath(path.module)
}
output "user" {
value = var.user
}
output "aws_profile" {
value = var.profile
}
output "aws_region" {
value = var.region
}
output "subnet_cidr_block" {
value = var.subnet_cidr_block
}
output "vpc_cidr_block" {
value = var.vpc_cidr_block
}
## Not used in Azure
# output "deployment_uuid" {
# value = random_uuid.deployment_uuid.result
# }
output "selinux_disabled" {
value = var.selinux_disabled
}
output "ssh_pub_key_path" {
value = var.ssh_pub_key_path
}
output "ssh_prv_key_path" {
value = var.ssh_prv_key_path
}
output "install_with_ssl" {
value = var.install_with_ssl
}
output "ca_cert" {
value = var.ca_cert
}
output "ca_key" {
value = var.ca_key
}
output "epic_dl_url" {
value = var.epic_dl_url
}
output "epid_dl_url_needs_presign" {
value = var.epid_dl_url_needs_presign
}
output "epic_dl_url_presign_options" {
value = var.epic_dl_url_presign_options
}
output "epic_options" {
value = var.epic_options
}
output "client_cidr_block" {
value = var.client_cidr_block
}
output "create_eip_controller" {
value = var.create_eip_controller
}
output "create_eip_gateway" {
value = var.create_eip_gateway
}
output "create_eip_rdp_linux_server" {
value = var.create_eip_rdp_linux_server
}
output "create_eks_cluster" {
value = var.create_eks_cluster
}
//// Gateway
output "gateway_instance_id" {
value = azurerm_linux_virtual_machine.gateway.id
}
output "gateway_private_ip" {
value = azurerm_network_interface.gatewaynic.private_ip_address
}
data "azurerm_public_ip" "gtw_public_ip" {
name = azurerm_public_ip.gatewaypip.name
resource_group_name = azurerm_linux_virtual_machine.gateway.resource_group_name
}
output "gateway_public_ip" {
value = var.create_eip_gateway ? data.azurerm_public_ip.gtw_public_ip.ip_address : "no public ip for gateway"
}
output "gateway_public_dns" {
value = var.create_eip_gateway ? "${var.project_id}.${var.region}.cloudapp.azure.com" : "no public dns for gateway"
}
output "gateway_private_dns" {
value = "${var.project_id}.internal.cloudapp.net"
}
//// Controller
output "controller_instance_id" {
value = azurerm_linux_virtual_machine.controller.id
}
output "controller_private_ip" {
value = azurerm_network_interface.controllernic.private_ip_address
}
output "controller_private_dns" {
value = azurerm_network_interface.controllernic.internal_domain_name_suffix
}
data "azurerm_public_ip" "ctr_public_ip" {
### Workaround if create_eip_controller is false (return gateway public ip)
name = var.create_eip_controller ? azurerm_public_ip.controllerpip[0].name : azurerm_public_ip.gatewaypip.name
resource_group_name = azurerm_linux_virtual_machine.controller.resource_group_name
}
output "controller_public_ip" {
value = data.azurerm_public_ip.ctr_public_ip.ip_address
}
output "controller_public_url" {
value = var.create_eip_controller ? "https://${data.azurerm_public_ip.ctr_public_ip.fqdn}" : "no public ip for controller"
}
output "controller_public_dns" {
value = var.create_eip_controller ? data.azurerm_public_ip.ctr_public_ip.fqdn : "no public dns for controller"
}
/// workers
output "workers_instance_id" {
value = [azurerm_linux_virtual_machine.workers.*.id]
}
output "workers_private_ip" {
value = [azurerm_network_interface.workernics.*.private_ip_address]
}
output "workers_private_dns" {
value = [azurerm_network_interface.workernics.*.internal_domain_name_suffix]
}
data "azurerm_public_ip" "wrks_public_ip" {
count = var.worker_count
name = azurerm_public_ip.workerspip[count.index].name
resource_group_name = azurerm_linux_virtual_machine.workers[count.index].resource_group_name
}
output "workers_public_ip" {
value = [data.azurerm_public_ip.wrks_public_ip.*.ip_address]
}
output "worker_count" {
value = [var.worker_count]
}
### TODO: Not implemented
/// GPU workers
# output "workers_gpu_instance_id" {
# value = [aws_instance.workers_gpu.*.id]
# }
# output "workers_gpu_public_ip" {
# value = [aws_instance.workers_gpu.*.public_ip]
# }
# output "workers_gpu_public_dns" {
# value = [aws_instance.workers_gpu.*.public_dns]
# }
# output "workers_gpu_private_ip" {
# value = [aws_instance.workers_gpu.*.private_ip]
# }
# output "workers_gpu_private_dns" {
# value = [aws_instance.workers_gpu.*.private_dns]
# }
output "gpu_worker_count" {
value = [var.gpu_worker_count]
}
## TODO: Not implemented
# //// MAPR Cluster 1
# output "mapr_cluster_1_hosts_instance_id" {
# value = [aws_instance.mapr_cluster_1_hosts.*.id]
# }
# output "mapr_cluster_1_hosts_public_ip" {
# value = [aws_instance.mapr_cluster_1_hosts.*.public_ip]
# }
# output "mapr_cluster_1_hosts_public_dns" {
# value = [aws_instance.mapr_cluster_1_hosts.*.public_dns]
# }
# output "mapr_cluster_1_hosts_private_ip" {
# value = [aws_instance.mapr_cluster_1_hosts.*.private_ip]
# }
# output "mapr_cluster_1_hosts_private_ip_flat" {
# value = join("\n", aws_instance.mapr_cluster_1_hosts.*.private_ip)
# }
# output "mapr_cluster_1_hosts_public_ip_flat" {
# value = join("\n", aws_instance.mapr_cluster_1_hosts.*.public_ip)
# }
# output "mapr_cluster_1_hosts_private_dns" {
# value = [aws_instance.mapr_cluster_1_hosts.*.private_dns]
# }
output "mapr_cluster_1_count" {
value = [var.mapr_cluster_1_count]
}
# output "mapr_cluster_1_name" {
# value = [var.mapr_cluster_1_name]
# }
# /// MAPR Cluster 2
# output "mapr_cluster_2_hosts_instance_id" {
# value = [aws_instance.mapr_cluster_2_hosts.*.id]
# }
# output "mapr_cluster_2_hosts_public_ip" {
# value = [aws_instance.mapr_cluster_2_hosts.*.public_ip]
# }
# output "mapr_cluster_2_hosts_public_dns" {
# value = [aws_instance.mapr_cluster_2_hosts.*.public_dns]
# }
# output "mapr_cluster_2_hosts_private_ip" {
# value = [aws_instance.mapr_cluster_2_hosts.*.private_ip]
# }
# output "mapr_cluster_2_hosts_private_ip_flat" {
# value = join("\n", aws_instance.mapr_cluster_2_hosts.*.private_ip)
# }
# output "mapr_cluster_2_hosts_public_ip_flat" {
# value = join("\n", aws_instance.mapr_cluster_2_hosts.*.public_ip)
# }
# output "mapr_cluster_2_hosts_private_dns" {
# value = [aws_instance.mapr_cluster_2_hosts.*.private_dns]
# }
output "mapr_cluster_2_count" {
value = [var.mapr_cluster_2_count]
}
# output "mapr_cluster_2_name" {
# value = [var.mapr_cluster_2_name]
# }
output "controller_ssh_command" {
value = var.create_eip_controller ? "ssh -o StrictHostKeyChecking=no -i \"${var.ssh_prv_key_path}\" ${var.user}@${data.azurerm_public_ip.ctr_public_ip.ip_address}" : "no public ip for controller"
}
output "gateway_ssh_command" {
value = var.create_eip_gateway ? "ssh -o StrictHostKeyChecking=no -i \"${var.ssh_prv_key_path}\" ${var.user}@${data.azurerm_public_ip.gtw_public_ip.ip_address}" : "no public ip for gateway"
}
output "workers_ssh" {
value = {
for instance in data.azurerm_public_ip.wrks_public_ip:
instance.ip_address => "ssh -o StrictHostKeyChecking=no -i '${var.ssh_prv_key_path}' centos@${instance.fqdn}"
}
}
# output "mapr_cluster_1_hosts_ssh" {
# value = {
# for instance in data.azurerm_public_ip.mapr_cluster1_hosts_public_ip:
# instance.private_ip => "ssh -o StrictHostKeyChecking=no -i '${var.ssh_prv_key_path}' centos@${instance.public_ip}"
# }
# }
// NFS Server Output
output "nfs_server_enabled" {
value = var.nfs_server_enabled
}
output "nfs_server_instance_id" {
value = var.nfs_server_enabled ? azurerm_linux_virtual_machine.nfs_server[0].id : "nfs server not enabled"
}
output "nfs_server_private_ip" {
value = var.nfs_server_enabled ? azurerm_network_interface.nfs_servernic.private_ip_address : "nfs server not enabled"
}
output "nfs_server_folder" {
value = var.nfs_server_enabled ? "/nfsroot" : "nfs server not enabled"
}
output "nfs_server_ssh_command" {
value = var.nfs_server_enabled ? "ssh -o StrictHostKeyChecking=no -i \"${var.ssh_prv_key_path}\" centos@${data.azurerm_public_ip.nfs_public_ip.ip_address}" : "nfs server not enabled"
}
// AD Server Output
output "ad_server_enabled" {
value = var.ad_server_enabled
}
output "ad_server_instance_id" {
value = var.ad_server_enabled ? azurerm_linux_virtual_machine.ad_server[0].id : "ad server not enabled"
}
output "ad_server_private_ip" {
value = var.ad_server_enabled ? azurerm_network_interface.ad_servernic.private_ip_address : "ad server not enabled"
}
output "ad_server_public_ip" {
value = var.ad_server_enabled ? data.azurerm_public_ip.ad_public_ip.ip_address : "ad server not enabled"
}
output "ad_server_ssh_command" {
value = var.ad_server_enabled ? "ssh -o StrictHostKeyChecking=no -i \"${var.ssh_prv_key_path}\" centos@${data.azurerm_public_ip.ad_public_ip.ip_address}" : "ad server not enabled"
}
// RDP Server Output
output "rdp_server_enabled" {
value = var.rdp_server_enabled
}
output "rdp_server_instance_id" {
value = var.rdp_server_enabled ? azurerm_linux_virtual_machine.rdp_server[0].id : "rdp server not enabled"
}
output "rdp_server_operating_system" {
value = var.rdp_server_enabled ? var.rdp_server_operating_system : "rdp server not enabled"
}
output "rdp_server_public_ip" {
value = var.create_eip_rdp_linux_server ? data.azurerm_public_ip.rdp_public_ip.ip_address : "no public ip for rdp server"
}
output "rdp_public_dns_name" {
value = var.create_eip_rdp_linux_server ? "${var.project_id}.${var.region}.cloudapp.azure.com" : "no public dns for rdp server"
}
output "rdp_ssh_command" {
value = var.create_eip_rdp_linux_server ? "ssh -o StrictHostKeyChecking=no -i \"${var.ssh_prv_key_path}\" ubuntu@${data.azurerm_public_ip.rdp_public_ip.fqdn}" : "no public ip for rdp server"
}
output "rdp_server_private_ip" {
value = var.rdp_server_enabled ? azurerm_network_interface.rdp_servernic.private_ip_address : "rdp server not enabled"
}
output "rdp_server_admin_password" {
sensitive = true
value = var.rdp_server_enabled ? random_password.rdp_admin_password.result : "rdp server not enabled"
}