cirruslabs / packer-plugin-tart

Packer builder for Tart VMs
https://developer.hashicorp.com/packer/plugins/builders/tart
Mozilla Public License 2.0
63 stars 16 forks source link

Don't delete `vm_name` if it already exists #160

Closed andrewhamon closed 1 month ago

andrewhamon commented 1 month ago

It seems that if there is already a vm with the same name as the one specified by vm_name, that VM will be overwritten. This seems a little dangerous, and might also have been the cause of https://github.com/cirruslabs/tart/issues/860

andrewhamon commented 1 month ago

Actually, this seems to be happening in tart itself. tart clone will happily clobber an existing image.

andrewhamon commented 1 month ago

According to https://github.com/cirruslabs/tart/issues/822 this is a desired behavior of tart, however I feel that in the context of packer, where a user runs packer build ... without necessarily knowing the resulting image name, this is rather sharp edge.

fkorotkov commented 1 month ago

What do you mean by "without necessarily knowing the resulting image name"?

For example, GCP's googlecompute builder also overrides image if image_name is not the default packer-{{timestamp}} one.

I guess this was a surprised behaviour during your first few runs but it's been like that from the creation and some folks use to this behaviour already.

andrewhamon commented 1 month ago

I just mean that by running a packer build I could unknowingly delete a vm with the same name as the vm_name in the packer template. The indirection makes what seems like a safe command (packer build) dangerous.

I worked around this by generating timestamp-based vm names.