terra-farm / terraform-provider-virtualbox

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

Image not cached after downloaded #73

Closed patsevanton closed 4 years ago

patsevanton commented 4 years ago

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

patsevanton commented 4 years ago

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
VoyTechnology commented 4 years ago

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.