From 5cfd26a0d336494f2273076b6f1cf2341bcec551 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 10 Jun 2015 19:29:48 -0700 Subject: [PATCH] builder/digitalocean: user data support [GH-2113] --- builder/digitalocean/config.go | 1 + builder/digitalocean/step_create_droplet.go | 1 + website/source/docs/builders/digitalocean.html.markdown | 2 ++ 3 files changed, 4 insertions(+) diff --git a/builder/digitalocean/config.go b/builder/digitalocean/config.go index 057138633..5621d64d7 100644 --- a/builder/digitalocean/config.go +++ b/builder/digitalocean/config.go @@ -26,6 +26,7 @@ type Config struct { PrivateNetworking bool `mapstructure:"private_networking"` SnapshotName string `mapstructure:"snapshot_name"` DropletName string `mapstructure:"droplet_name"` + UserData string `mapstructure:"user_data"` SSHUsername string `mapstructure:"ssh_username"` SSHPort uint `mapstructure:"ssh_port"` diff --git a/builder/digitalocean/step_create_droplet.go b/builder/digitalocean/step_create_droplet.go index 40ac8f0e9..aafd53622 100644 --- a/builder/digitalocean/step_create_droplet.go +++ b/builder/digitalocean/step_create_droplet.go @@ -31,6 +31,7 @@ func (s *stepCreateDroplet) Run(state multistep.StateBag) multistep.StepAction { godo.DropletCreateSSHKey{ID: int(sshKeyId)}, }, PrivateNetworking: c.PrivateNetworking, + UserData: c.UserData, }) if err != nil { err := fmt.Errorf("Error creating droplet: %s", err) diff --git a/website/source/docs/builders/digitalocean.html.markdown b/website/source/docs/builders/digitalocean.html.markdown index 34d11bedb..829424e3d 100644 --- a/website/source/docs/builders/digitalocean.html.markdown +++ b/website/source/docs/builders/digitalocean.html.markdown @@ -67,6 +67,8 @@ each category, the available configuration keys are alphabetized. for a droplet to enter a desired state (such as "active") before timing out. The default state timeout is "6m". +* `user_data` (string) - User data to launch with the Droplet. + ## Basic Example Here is a basic example. It is completely valid as soon as you enter your