terra-farm/terraform-provider-virtualbox

Image not cached after downloaded

patsevanton opened this issue · 2 comments

Terraform config:

resource "virtualbox_vm" "squid" {
  count     = 1
  name      = "squid"
  image     = "https://vagrantcloud.com/geerlingguy/boxes/centos7/versions/1.2.16/providers/virtualbox.box"
  cpus      = 1
  memory    = "256 mib"

  network_adapter {
    type           = "hostonly"
    host_interface = "vboxnet1"
  }
}```

Run first time:

time terraform apply -auto-approve
real 4m35,572s
user 0m14,910s
sys 0m16,285s


Destroy VM:
`terraform destroy`

Run second time:

time terraform apply -auto-approve
real 4m28,781s
user 0m10,654s
sys 0m15,988s


Download image

time wget https://vagrantcloud.com/geerlingguy/boxes/centos7/versions/1.2.16/providers/virtualbox.box
real 3m27,139s
user 0m3,580s
sys 0m8,700s

Terraform config

resource "virtualbox_vm" "squid" {
  count     = 1
  name      = "squid"
  image     = "virtualbox.box"
  cpus      = 1
  memory    = "256 mib"

  network_adapter {
    type           = "hostonly"
    host_interface = "vboxnet1"
  }
}

Run terraform with local image:

time terraform apply -auto-approve

real    0m41,331s
user    0m2,637s
sys 0m1,108s

Yes, this has been on the wishlist for a while, and will be a part of migrating to disks as its own resource (#49). I am going to mention your comments in there and caching will be implemented as part of it.