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 358e770db8
commit 6186e66d27
2 changed files with 8 additions and 2 deletions

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