Skip to content

Commit

Permalink
Specify ssh_key_id in template to provision with SSH Key of that id
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Tay committed Oct 20, 2015
1 parent 6b9172c commit b800f89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builder/softlayer/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type Config struct {
RawStateTimeout string `mapstructure:"instance_state_timeout"`
StateTimeout time.Duration

SSHKeyID int64 `mapstructure:"ssh_key_id"`

ctx interpolate.Context
}

Expand Down
4 changes: 4 additions & 0 deletions builder/softlayer/step_create_ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func (self *stepCreateSshKey) Run(state multistep.StateBag) multistep.StepAction

state.Put("ssh_private_key", string(privateKeyBytes))

// Provision with ssh_key_id if specified
config := state.Get("config").(Config)
state.Put("ssh_key_id", config.SSHKeyID)

return multistep.ActionContinue
}

Expand Down

1 comment on commit b800f89

@toyray
Copy link
Member

@toyray toyray commented on b800f89 Oct 29, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Associate id of SSH key saved in SoftLayer to the provisioned instance so that we can authenticate with the same key in ssh_private_key_file later.

Please sign in to comment.