diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dc0b6c3f..2bc9213bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ ## 0.2.2 (unreleased) +IMPROVEMENTS: + * providers/digitalocean: Handle 404 on delete + * providers/digitalocean: Add user_data argument for creating droplets ## 0.2.1 (August 31, 2014) diff --git a/builtin/providers/digitalocean/resource_digitalocean_droplet.go b/builtin/providers/digitalocean/resource_digitalocean_droplet.go index 4fb83b816..d0fb28393 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_droplet.go +++ b/builtin/providers/digitalocean/resource_digitalocean_droplet.go @@ -34,6 +34,7 @@ func resource_digitalocean_droplet_create( PrivateNetworking: rs.Attributes["private_networking"], Region: rs.Attributes["region"], Size: rs.Attributes["size"], + UserData: rs.Attributes["user_data"], } // Only expand ssh_keys if we have them @@ -249,6 +250,7 @@ func resource_digitalocean_droplet_diff( "region": diff.AttrTypeCreate, "size": diff.AttrTypeUpdate, "ssh_keys": diff.AttrTypeCreate, + "user_data": diff.AttrTypeCreate, }, ComputedAttrs: []string{ @@ -322,6 +324,7 @@ func resource_digitalocean_droplet_validation() *config.Validator { }, Optional: []string{ "backups", + "user_data", "ipv6", "private_networking", "ssh_keys.*", diff --git a/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go b/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go index f98adc1f8..704079e7b 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go +++ b/builtin/providers/digitalocean/resource_digitalocean_droplet_test.go @@ -30,7 +30,9 @@ func TestAccDigitalOceanDroplet_Basic(t *testing.T) { resource.TestCheckResourceAttr( "digitalocean_droplet.foobar", "image", "centos-5-8-x32"), resource.TestCheckResourceAttr( - "digitalocean_droplet.foobar", "region", "nyc2"), + "digitalocean_droplet.foobar", "region", "nyc3"), + resource.TestCheckResourceAttr( + "digitalocean_droplet.foobar", "user_data", "foobar"), ), }, }, @@ -242,7 +244,8 @@ resource "digitalocean_droplet" "foobar" { name = "foo" size = "512mb" image = "centos-5-8-x32" - region = "nyc2" + region = "nyc3" + user_data = "foobar" } ` diff --git a/website/source/docs/providers/do/r/droplet.html.markdown b/website/source/docs/providers/do/r/droplet.html.markdown index ee29a7dbb..ebe4931ce 100644 --- a/website/source/docs/providers/do/r/droplet.html.markdown +++ b/website/source/docs/providers/do/r/droplet.html.markdown @@ -37,6 +37,9 @@ The following arguments are supported: the format `[12345, 123456]`. To retrieve this info, use a tool such as `curl` with the [DigitalOcean API](https://developers.digitalocean.com/#keys), to retrieve them. +* `user_data` (Optional) - A string of the desired User Data for the Droplet. + User Data is currently only available in regions with metadata + listed in their features. ## Attributes Reference