terra-farm / terraform-provider-virtualbox

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

Use Image OR Url #19

Closed tylerauerbeck closed 5 years ago

tylerauerbeck commented 6 years ago

Currently, the documentation says the following:

image, string, required: The place of the image file(archive or vagrant box).
url, string, optional, default not set: The url for downloaded vagrant box from external resource (ex. Ubuntu Vagrant box) . If not set using image variable.

My assumption from looking at this documentation is that if I don't specify image (i.e. I don't have the image locally), I can specify Url and it should go pull this from me. I attempt this and get the following:

"image": required field is not set

So I assume maybe it just wants the name of the box as well as the URL, which is fine. But I run this agin with the image name that I want to use (minimal/centos7). But again, I receive another error

open minimal/centos7: no such file or directory

So are my assumptions wrong? Will this provider only work with local copies of an image?

For reference, this is my config:

resource "virtualbox_vm" "worker" {
  count = 2
  name  = "${format("kworker-%02d", count.index+1)}"

  image  = ""
  url    = "https://app.vagrantup.com/minimal/boxes/centos7"
  cpus   = 2
  memory = "1024mb"
  status = "running"

  network_adapter {
    type = "nat"
  }

  network_adapter {
    type           = "hostonly"
    host_interface = "eth0"
  }
}
pyToshka commented 6 years ago

@tylerauerbeck You use wrong link, link should content full path to image. example https://vagrantcloud.com/minimal/boxes/centos7/versions/7.0/providers/virtualbox.box

pyToshka commented 6 years ago

if need i can implement recursive finding for boxes

tylerauerbeck commented 6 years ago

@pyToshka Ahh, yeah it looks like I didn't use the whole path there. However, I tried this again after making sure that the full Url was there and I'm still seeing that url can't be used without an image being supplied. Isn't the use of both of these a bit redundant? Wouldn't you either want to use a local image or point to one sitting in vagrantcloud or elsehwere?

VoyTechnology commented 5 years ago

This was completed in #40