Skip to content

Instantly share code, notes, and snippets.

@chfrodin
Created March 12, 2020 19:57
Show Gist options
  • Save chfrodin/6dde1a7353f933e485cad477684b742c to your computer and use it in GitHub Desktop.
Save chfrodin/6dde1a7353f933e485cad477684b742c to your computer and use it in GitHub Desktop.
resource "vsphere_virtual_machine" "vm" {
name = var.vm_name
guest_id = var.guest_id
resource_pool_id = data.vsphere_compute_cluster.cluster.resource_pool_id
datastore_id = data.vsphere_datastore.datastore.id
tags = var.tags
folder = var.folder
host_system_id = var.host_system_id
storage_policy_id = var.storage_policy_id
#scsi_type = data.vsphere_virtual_machine.template.scsi_type
firmware = var.firmware != null ? var.firmware : data.vsphere_virtual_machine.template.firmware
#--CPU and memory options--
num_cpus = var.num_cpus
num_cores_per_socket = var.num_cores_per_socket
cpu_hot_add_enabled = var.cpu_hot_add_enabled
cpu_hot_remove_enabled = var.cpu_hot_remove_enabled
memory = var.memory
memory_hot_add_enabled = var.memory_hot_add_enabled
#--Resource allocation options--
cpu_limit = var.cpu_limit
cpu_reservation = var.cpu_reservation
cpu_share_level = var.cpu_share_level
cpu_share_count = var.cpu_share_count
memory_limit = var.memory_limit
memory_reservation = var.memory_reservation
memory_share_level = var.memory_share_level
memory_share_count = var.memory_share_count
#Boot options
#boot_delay = var.boot_delay
#efi_secure_boot_enabled = var.efi_secure_boot_enabled
#boot_retry_delay
#boot_retry_enabled
network_interface {
network_id = data.vsphere_network.network.id
}
disk {
label = var.disk_label
size = var.disk_size
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment