Commit 0a76d073 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/amazon: provision on instance

parent 2f9840a4
......@@ -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)
......
......@@ -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!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment