hashicorp / packer-plugin-googlecompute

Packer plugin for Google Compute Builder
https://www.packer.io/docs/builders/googlecompute
Mozilla Public License 2.0
23 stars 51 forks source link

Do not emit ssh public key removal logs when using ssh private key file #161

Closed ralbertazzi closed 1 year ago

ralbertazzi commented 1 year ago

Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request. If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

I'm using this Packer plugin with OS Login and a user-specified private key file. The plugin logs correctly report that an SSH key has been imported, but they mistakenly report at the end of the build that the key has been deleted. These logs confused me and, while I believe that no key has been deleted (I can in fact still see the key through gcloud compute os-login describe-profile and I successfully managed to launch multiple consecutive builds with the same key), I would like for the logs not to be emitted at all to avoid confusion.

Interesting configuration

ssh_private_key_file = "/path/to/private/key"
ssh_username = "sa-username"
use_os_login = true

When this configuration is used, these logs should not be emitted:

2023-05-05T16:25:04Z: ==> googlecompute.cos_image: Deleting SSH public key for OSLogin...
2023-05-05T16:25:04Z:     googlecompute.cos_image: SSH public key for OSLogin has been deleted!