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_controller.tf
54 lines (54 loc) · 1.64 KB
/
bluedata_infra_controller.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
# Controller VM
resource "vsphere_virtual_machine" "controller" {
name = "${var.project_id}-ctrl"
resource_pool_id = data.vsphere_resource_pool.pool.id
# custom_data = base64encode(file(pathexpand(var.cloud_init_file)))
datastore_id = data.vsphere_datastore.datastore.id
num_cpus = var.ctr_instance_cpu
memory = var.ctr_instance_memory
guest_id = data.vsphere_virtual_machine.template.guest_id
scsi_type = data.vsphere_virtual_machine.template.scsi_type
network_interface {
network_id = data.vsphere_network.network.id
}
disk {
label = "${var.project_id}-ctrl-os-disk"
size = "400"
thin_provisioned = true
}
# clone from template
clone {
template_uuid = data.vsphere_virtual_machine.template.id
customize {
linux_options {
host_name = "${var.project_id}-ctrl"
domain = var.domain
time_zone = var.timezone
}
network_interface { } // use dhcp
}
}
/********** Data Disks **********/
disk {
label = "${var.project_id}-ctrl-disk1"
size = 512
unit_number = 1
}
disk {
label = "${var.project_id}-ctrl-disk2"
size = 512
unit_number = 2
}
provisioner "remote-exec" {
inline = [
"sudo yum install -y -q cloud-utils-growpart",
"sudo growpart /dev/sda 3",
"sudo xfs_growfs /"
]
connection {
host = self.default_ip_address
user = var.user
private_key = file(var.ssh_prv_key_path)
}
}
}