diff --git a/builder/proxmox/common/builder.go b/builder/proxmox/common/builder.go index a10fd691..ae3d0801 100644 --- a/builder/proxmox/common/builder.go +++ b/builder/proxmox/common/builder.go @@ -67,7 +67,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook, }, &commonsteps.StepProvision{}, &commonsteps.StepCleanupTempKeys{ - Comm: &b.config.Comm, + Comm: comm, }, &stepRemoveCloudInitDrive{}, &stepConvertToTemplate{}, @@ -75,6 +75,14 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook, &stepSuccess{}, } preSteps := b.preSteps + if (*comm).Type == "ssh" { + preSteps = append(preSteps, + &communicator.StepSSHKeyGen{ + CommConf: comm, + SSHTemporaryKeyPair: (*comm).SSHTemporaryKeyPair, + }, + ) + } for idx := range b.config.ISOs { if b.config.ISOs[idx].ISODownloadPVE { preSteps = append(preSteps,