Open zhoutian77 opened 3 years ago
dynamic "disk" {
for_each = var.data_disk
iterator = terraform_disks
content {
label = terraform_disks.key
attach = true
datastore_id = var.disk_datastore != "" ? data.vsphere_datastore.disk_datastore[0].id : null
path = vsphere_virtual_disk.disk[terraform_disks.key].vmdk_path
unit_number = (
lookup(
terraform_disks.value,
"unit_number",
-1
) < 0 ? (
lookup(
terraform_disks.value,
"data_disk_scsi_controller",
0
) > 0 ? (
(terraform_disks.value.data_disk_scsi_controller * 15) +
index(keys(var.data_disk), terraform_disks.key) +
(var.scsi_controller == tonumber(terraform_disks.value["data_disk_scsi_controller"]) ? local.template_disk_count : 0)
) : (
index(keys(var.data_disk), terraform_disks.key) + local.template_disk_count
)
) : (
tonumber(terraform_disks.value["unit_number"])
)
)
disk_sharing = lookup(terraform_disks.value, "scsi_bus_sharing", "physicalSharing") # Use scsi_bus_sharing value or default to "physicalSharing"
# ...
}
}
I want to create a virtual machine with two SCSI buses of different types But I don't know how to write tf files, can you help me? My current configuration looks like this:
` .....other..configration..... variable "scsi_bus_sharing" { description = "scsi_bus_sharing mode, acceptable values physicalSharing,virtualSharing,noSharing." type = string default = "physicalSharing" }
variable "scsi_type" { description = "scsi_controller type, acceptable values lsilogic,pvscsi." type = string default = "" }
variable "data_disk" { description = "Storage data disk parameter, example" type = map(map(string)) default = { "rac1-rac2-sharedisk1-02"={ "data_disk_scsi_controller"= 1, "size_gb"= 10 }, "rac1-rac2-sharedisk2-02"={ "data_disk_scsi_controller"= 1, "size_gb"= 10 } } }
variable "disk_label" { description = "Storage data disk labels." type = list(any) default = [] }
} resource "vsphere_virtual_machine" "vm1" { depends_on = [vsphere_virtual_disk.disk,] count = "1" name = "rac01-01" resource_pool_id = data.vsphere_resource_pool.pool.id datastore_id = var.disk_datastore != "" ? data.vsphere_datastore.disk_datastore[0].id : null wait_for_guest_net_timeout = 0 wait_for_guest_ip_timeout = 0
}
.....other..configration..... `
The 'scsi_bus_sharing' argument seems to specify the shared type of all controllers directly. Can I set different share types on different controllers?
thank you