providers/digitalocean: add user_data for create droplet

fixes #267
This commit is contained in:
Jack Pearkes 2014-09-05 11:16:12 -04:00
parent bf52f3886b
commit 28692656e2
4 changed files with 14 additions and 2 deletions

View File

@ -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)

View File

@ -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.*",

View File

@ -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"
}
`

View File

@ -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