Making user_data force a new droplet for DigitalOcean
This commit is contained in:
parent
9e9d4b2c72
commit
ffdd4de326
|
@ -100,6 +100,7 @@ func resourceDigitalOceanDroplet() *schema.Resource {
|
|||
"user_data": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue