From 7081fe990b8b0ae9bc49b557a4769f97846ec9fb Mon Sep 17 00:00:00 2001 From: Mike Zupan Date: Mon, 30 Jul 2018 07:52:40 -0600 Subject: [PATCH] Adding in droplet tags on creation --- builder/digitalocean/config.go | 5 +++++ builder/digitalocean/step_create_droplet.go | 1 + 2 files changed, 6 insertions(+) diff --git a/builder/digitalocean/config.go b/builder/digitalocean/config.go index 6e58bc759..f2f389b7a 100644 --- a/builder/digitalocean/config.go +++ b/builder/digitalocean/config.go @@ -35,6 +35,7 @@ type Config struct { DropletName string `mapstructure:"droplet_name"` UserData string `mapstructure:"user_data"` UserDataFile string `mapstructure:"user_data_file"` + RunTags []string `mapstructure:"run_tags"` ctx interpolate.Context } @@ -121,6 +122,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { } } + if c.RunTags == nil { + c.RunTags = make([]string, 0) + } + if errs != nil && len(errs.Errors) > 0 { return nil, nil, errs } diff --git a/builder/digitalocean/step_create_droplet.go b/builder/digitalocean/step_create_droplet.go index d9c8976bf..a67e28e79 100644 --- a/builder/digitalocean/step_create_droplet.go +++ b/builder/digitalocean/step_create_droplet.go @@ -49,6 +49,7 @@ func (s *stepCreateDroplet) Run(_ context.Context, state multistep.StateBag) mul Monitoring: c.Monitoring, IPv6: c.IPv6, UserData: userData, + Tags: c.RunTags, }) if err != nil { err := fmt.Errorf("Error creating droplet: %s", err)