diff --git a/builder/amazon/common/ssh.go b/builder/amazon/common/ssh.go index 77e1d6c53..ea589189f 100644 --- a/builder/amazon/common/ssh.go +++ b/builder/amazon/common/ssh.go @@ -7,6 +7,8 @@ import ( "github.com/mitchellh/packer/communicator/ssh" ) +// SSHAddress returns a function that can be given to the SSH communicator +// for determining the SSH address based on the instance DNS name. func SSHAddress(port int) func(map[string]interface{}) (string, error) { return func(state map[string]interface{}) (string, error) { instance := state["instance"].(*ec2.Instance) @@ -14,6 +16,9 @@ func SSHAddress(port int) func(map[string]interface{}) (string, error) { } } +// SSHConfig returns a function that can be used for the SSH communicator +// config for connecting to the instance created over SSH using the generated +// private key. func SSHConfig(username string) func(map[string]interface{}) (*gossh.ClientConfig, error) { return func(state map[string]interface{}) (*gossh.ClientConfig, error) { privateKey := state["privateKey"].(string) diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index 0606de521..6826c2c31 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -84,6 +84,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe SSHConfig: awscommon.SSHConfig(b.config.SSHUsername), SSHWaitTimeout: b.config.SSHTimeout(), }, + &common.StepProvision{}, } // Run!