diff --git a/outscale/resource_outscale_nic_test.go b/outscale/resource_outscale_nic_test.go index bf6238a52..b8f74cbe8 100644 --- a/outscale/resource_outscale_nic_test.go +++ b/outscale/resource_outscale_nic_test.go @@ -19,27 +19,30 @@ func TestAccOutscaleOAPIENI_basic(t *testing.T) { t.Parallel() var conf oscgo.Nic subregion := os.Getenv("OUTSCALE_REGION") + resourceName := "outscale_nic.outscale_nic" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "outscale_nic.outscale_nic", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckOutscaleOAPINICDestroy, Steps: []resource.TestStep{ { Config: testAccOutscaleOAPIENIConfig(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleOAPIENIExists(resourceName, &conf), testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), - resource.TestCheckResourceAttr("outscale_nic.outscale_nic", "private_ips.#", "2"), + resource.TestCheckResourceAttr(resourceName, "primary_private_ip.#", "1"), + resource.TestCheckResourceAttr(resourceName, "secondary_private_ips.#", "1"), ), }, { Config: testAccOutscaleOAPIENIConfigUpdate(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleOAPIENIExists(resourceName, &conf), testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), - resource.TestCheckResourceAttr("outscale_nic.outscale_nic", "private_ips.#", "3"), + resource.TestCheckResourceAttr(resourceName, "primary_private_ip.#", "1"), + resource.TestCheckResourceAttr(resourceName, "secondary_private_ips.#", "2"), ), }, }, @@ -130,13 +133,11 @@ func testAccOutscaleOAPIENIConfig(subregion string) string { subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" security_group_ids = ["${outscale_security_group.outscale_sg.security_group_id}"] - private_ips { - is_primary = true + primary_private_ip { private_ip = "10.0.0.23" } - private_ips { - is_primary = false + secondary_private_ips { private_ip = "10.0.0.46" } } @@ -169,18 +170,15 @@ func testAccOutscaleOAPIENIConfigUpdate(subregion string) string { subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" security_group_ids = ["${outscale_security_group.outscale_sg.security_group_id}"] - private_ips { - is_primary = true + primary_private_ip { private_ip = "10.0.0.23" } - private_ips { - is_primary = false + secondary_private_ips { private_ip = "10.0.0.46" } - private_ips { - is_primary = false + secondary_private_ips { private_ip = "10.0.0.69" } }