diff --git a/builder/scaleway/builder.go b/builder/scaleway/builder.go index f0c5fc8ab..2f668f994 100644 --- a/builder/scaleway/builder.go +++ b/builder/scaleway/builder.go @@ -49,9 +49,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe steps := []multistep.Step{ &stepCreateSSHKey{ - Debug: b.config.PackerDebug, - DebugKeyPath: fmt.Sprintf("scw_%s.pem", b.config.PackerBuildName), - PrivateKeyFile: b.config.Comm.SSHPrivateKeyFile, + Debug: b.config.PackerDebug, + Comm: &b.config.Comm, + DebugKeyPath: fmt.Sprintf("scw_%s.pem", b.config.PackerBuildName), }, new(stepCreateServer), new(stepServerInfo), diff --git a/builder/scaleway/step_create_ssh_key.go b/builder/scaleway/step_create_ssh_key.go index f2e92a0e6..fa23ad065 100644 --- a/builder/scaleway/step_create_ssh_key.go +++ b/builder/scaleway/step_create_ssh_key.go @@ -13,24 +13,25 @@ import ( "os" "runtime" + "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "golang.org/x/crypto/ssh" ) type stepCreateSSHKey struct { - Debug bool - DebugKeyPath string - PrivateKeyFile string + Debug bool + Comm *communicator.Config + DebugKeyPath string } func (s *stepCreateSSHKey) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) config := state.Get("config").(*Config) - if s.PrivateKeyFile != "" { + if s.Comm.SSHPrivateKeyFile != "" { ui.Say("Using existing SSH private key") - privateKeyBytes, err := ioutil.ReadFile(s.PrivateKeyFile) + privateKeyBytes, err := ioutil.ReadFile(s.Comm.SSHPrivateKeyFile) if err != nil { state.Put("error", fmt.Errorf( "Error loading configured private key file: %s", err))