terra-farm / terraform-provider-virtualbox

VirtualBox provider for Terraform
https://terra-farm.github.io/provider-virtualbox/
MIT License
323 stars 134 forks source link

[RFE] Ability to specify the size of the disks #116

Closed leodotcloud closed 3 years ago

leodotcloud commented 3 years ago

Enhancement request:

Would be great if there was a way to specify the size of the disks of a VM. For example, one can specify the disk config in Vagrantfile as:

node.vm.disk :disk, size: "80GB", primary: true
VoyTechnology commented 3 years ago

I completely agree. I am currently working on adding virtualbox_disk resource and data, and hopefully will have a basic PR in the next couple of days (it will not integrate it with virtualbox_vm at first). Intially I am thinking of the following:

resource "virtualbox_disk" "disk" {
  name      = "primary_disk"
  format    = "VDI"
  capacity  = "80G"
  flexible  = true
  encrypted = false

  # the following will be the computed properties
  # location = "<base_location>/primary_disk.vdi" # Maybe this will be customisable
  # uuid     = "<computed>"
}

The underlying go-virtualbox currently doesn't have much support for disk creation and reading so that has to be added first.

Most likely this means we will also need virtualbox_disk_controller, and the process would be to attach disk->controller->vm, but this will be discussed later.

For data source it might be a bit complicated/clever, where you might specify a remote image which will be un-tar-ed, like the current process, but also use exisiting disk you have.


On a side note, I've noticed you have been active with the project in the last few days, would you be interested in becoming a maintainer?

VoyTechnology commented 3 years ago

I have created the issue to https://github.com/terra-farm/terraform-provider-virtualbox/issues/119 which tracks the solution, so I am closing this as a duplicate. As I mentioned in my last response, adding the resource and data source should be the solution to your problem.

leodotcloud commented 3 years ago

@VoyTechnology Please check your email, DMed you.