packer-builder-vagrant icon indicating copy to clipboard operation
packer-builder-vagrant copied to clipboard

Can't set vm_name property within virtualbox-ovf builder

Open avishnyakov opened this issue 6 years ago • 2 comments

@themalkolm , should the following config work?

Setting up vm_name property within nested build. Build fails saying it can't resolve variables - build_type, timestamp, build_name and so on.

"vm_name": "pv-{{ build_type }}-{{ timestamp }}",
{
        "type": "vagrant",

        "box_provider": "virtualbox",
        "box_file": ".ovf",
        "box_name": "{{user `input_box_name` }}",

        "builder": {
            "type": "virtualbox-ovf",

            "vm_name": "pv-{{ build_type }}-{{ timestamp }}",

            "output_directory": "{{user `output_directory`}}",
            "http_directory": "{{user `http_directory`}}",

            "headless": "true",
            "boot_wait": "30s",

            ....
        }
    }

Native virtualbox-iso builder allows vm_name setup, it works well.

https://www.packer.io/docs/builders/virtualbox-iso.html#vm_name

avishnyakov avatar Jan 08 '19 01:01 avishnyakov

Custom name helps to distinguish VMs used for packer builds. For example, clean up of broken build leftovers is a trivial one.

Currently, this packer-vagrant builder makes packer--3434545 names, feels like it can't interpolate build-int variables by default leaving double dash "--" between packer and timestamp or something?

avishnyakov avatar Jan 08 '19 01:01 avishnyakov

I believe I didn’t bother to implement proper template support there. We can enable some specific variables if you want though.

themalkolm avatar Feb 04 '19 16:02 themalkolm