Skip to content

Commit

Permalink
Merge pull request #3740 from stack72/f-do-userdata-new
Browse files Browse the repository at this point in the history
provider/digitalocean: Making user_data force a new droplet
  • Loading branch information
phinze committed Nov 4, 2015
2 parents 9e9d4b2 + ffdd4de commit 94d9031
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func resourceDigitalOceanDroplet() *schema.Resource {
"user_data": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,36 @@ func TestAccDigitalOceanDroplet_Update(t *testing.T) {
})
}

func TestAccDigitalOceanDroplet_UpdateUserData(t *testing.T) {
var droplet godo.Droplet

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDigitalOceanDropletDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccCheckDigitalOceanDropletConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckDigitalOceanDropletExists("digitalocean_droplet.foobar", &droplet),
testAccCheckDigitalOceanDropletAttributes(&droplet),
),
},

resource.TestStep{
Config: testAccCheckDigitalOceanDropletConfig_userdata_update,
Check: resource.ComposeTestCheckFunc(
testAccCheckDigitalOceanDropletExists("digitalocean_droplet.foobar", &droplet),
resource.TestCheckResourceAttr(
"digitalocean_droplet.foobar",
"user_data",
"foobar foobar"),
),
},
},
})
}

func TestAccDigitalOceanDroplet_PrivateNetworkingIpv6(t *testing.T) {
var droplet godo.Droplet

Expand Down Expand Up @@ -261,6 +291,16 @@ resource "digitalocean_droplet" "foobar" {
}
`

const testAccCheckDigitalOceanDropletConfig_userdata_update = `
resource "digitalocean_droplet" "foobar" {
name = "foo"
size = "512mb"
image = "centos-5-8-x32"
region = "nyc3"
user_data = "foobar foobar"
}
`

const testAccCheckDigitalOceanDropletConfig_RenameAndResize = `
resource "digitalocean_droplet" "foobar" {
name = "baz"
Expand Down

0 comments on commit 94d9031

Please sign in to comment.