Skip to content

Commit

Permalink
Merge pull request #35 from SamyCoenen/feature/resource-reservation
Browse files Browse the repository at this point in the history
Add cpu, mem reservations
  • Loading branch information
Arman-Keyoumarsi authored Jul 18, 2020
2 parents 406d8c3 + 3976398 commit 024a626
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This Terraform module deploys single or multiple virtual machines of type (Linux
- Ability to configure advance features for the vm.
- Ability to deploy either a datastore or a datastore cluster.
- Ability to enable cpu and memory hot plug features for the VM.
- Ability to enable cpu and memory reservations for the VM.
- Ability to define different datastores for data disks.
- Ability to define different scsi_controllers per disk, including data disks.
- Ability to define network type per interface and disk label per attached disk.
Expand Down Expand Up @@ -100,6 +101,8 @@ module "example-server-windowsvm-advanced" {
instances = 2
cpu_number = 2
ram_size = 2096
cpu_reservation = 2000
memory_reservation = 2000
cpu_hot_add_enabled = "true"
cpu_hot_remove_enabled = "true"
memory_hot_add_enabled = "true"
Expand Down
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ resource "vsphere_virtual_machine" "Linux" {
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
cpu_reservation = var.cpu_reservation
memory_reservation = var.memory_reservation
memory = var.ram_size
memory_hot_add_enabled = var.memory_hot_add_enabled
guest_id = data.vsphere_virtual_machine.template.guest_id
Expand Down Expand Up @@ -175,6 +177,8 @@ resource "vsphere_virtual_machine" "Windows" {
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
cpu_reservation = var.cpu_reservation
memory_reservation = var.memory_reservation
memory = var.ram_size
memory_hot_add_enabled = var.memory_hot_add_enabled
guest_id = data.vsphere_virtual_machine.template.guest_id
Expand Down
11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ variable "cpu_number" {
default = 2
}

variable "cpu_reservation" {
description = "The amount of CPU (in MHz) that this virtual machine is guaranteed."
default = null
}


variable "ram_size" {
description = "VM RAM size in megabytes"
default = 4096
Expand Down Expand Up @@ -150,6 +156,11 @@ variable "memory_hot_add_enabled" {
default = null
}

variable "memory_reservation" {
description = "The amount of memory (in MB) that this virtual machine is guaranteed."
default = null
}

variable "disk_label" {
description = "Storage data disk labels"
type = list
Expand Down

0 comments on commit 024a626

Please sign in to comment.