scaleway: add 'bootscript' configuration parameter

This commit is contained in:
Julien BONACHERA 2018-06-29 19:44:56 +02:00
parent 5952892e10
commit eda85a4daf
No known key found for this signature in database
GPG Key ID: 799C119A66AF218A
2 changed files with 7 additions and 0 deletions

View File

@ -29,6 +29,7 @@ type Config struct {
SnapshotName string `mapstructure:"snapshot_name"`
ImageName string `mapstructure:"image_name"`
ServerName string `mapstructure:"server_name"`
Bootscript string `mapstructure:"bootscript"`
UserAgent string
ctx interpolate.Context

View File

@ -20,9 +20,14 @@ func (s *stepCreateServer) Run(_ context.Context, state multistep.StateBag) mult
c := state.Get("config").(Config)
sshPubKey := state.Get("ssh_pubkey").(string)
tags := []string{}
var bootscript *string
ui.Say("Creating server...")
if c.Bootscript != "" {
bootscript = &c.Bootscript
}
if sshPubKey != "" {
tags = []string{fmt.Sprintf("AUTHORIZED_KEY=%s", strings.TrimSpace(sshPubKey))}
}
@ -33,6 +38,7 @@ func (s *stepCreateServer) Run(_ context.Context, state multistep.StateBag) mult
Organization: c.Organization,
CommercialType: c.CommercialType,
Tags: tags,
Bootscript: bootscript,
})
if err != nil {