How to delete packer build VM in GCP?

Hi,
I’m running Packer with ‘googlecompute’ provider (@ GCP), using GitHub Actions for orchestration. But in fact it’s just running “packer build …” command.
Everything is fine - new image is created, and a temporary ‘packer’ VM instance is cleaned at the end.
But if the process is aborted in the middle, a temporary ‘packer’ VM isn’t deleted.
Is there an elegant way to delete a temporary build instance in this case?
I understand that it’s the default behavior of the ‘packer build’ command in case of error, but I want to do the same in case of abort.

Thank you,
Vitaly

Hi Vitaly,

I have not been working with GCP so I might be wrong here but I don’t think Packer has such functionality.

However, maybe you can leverage this somehow instead?

Hope this helps.
-Mike

1 Like

Mike,
Thank you.

However, maybe you can leverage this somehow instead?

It’s not 100% suitable for my needs, but it’s an interesting direction.

1 Like