feat: Add SSHKeyGen Step from SDK#96
Conversation
This makes use of the SSH communicators temporary key generation The builders already referenced "StepCleanupTempKeys" but since none were created it did nothing
|
Hi @LIV2 👋 - Could you please submit an enhancement request so that this pull request can be tracked back to the use case? From the README:
Thanks! Ryan Johnson |
There was a problem hiding this comment.
Thanks for opening up this change @LIV2. Our focus has been on updating Packer core mainly around HCL2, the go-cty bug, and plugin integration docs so I wasn't able to get to this PR. I think this is a nice change that folks can benefit from. The example documentation is a nice touch. Before merging I will make a small change to only generate the SSHKey if using the "ssh" communicator, as opposed to always generating an SSK key.
| &vmwcommon.StepSuppressMessages{}, | ||
| &vmwcommon.StepHTTPIPDiscover{}, | ||
| commonsteps.HTTPServerFromHTTPConfig(&b.config.HTTPConfig), | ||
| &communicator.StepSSHKeyGen{ |
There was a problem hiding this comment.
We should only call StepSSHKeyGen if the configured communicator is "ssh" otherwise a SSH key will get generated when using winrm or no communicator at all. Which might be confusing.
| &communicator.StepSSHKeyGen{ | |
| multistep.If(b.config.Comm.Type == "ssh", &communicator.StepSSHKeyGen{ |
This change adds the SSHKeyGen step from the SDK.
This step will generate a temporary ssh keypair when there is no ssh password and no ssh key configured.
The code already includes the "StepCleanupTempKeys" step which I believe does nothing without the SSHKeyGen step anyway.
Also included is the ability to use the
SSHPublicKeyvariable inside the boot command, I copied this from the VirtualBox builder.Closes #102