diff --git a/builtin/providers/openstack/provider_test.go b/builtin/providers/openstack/provider_test.go index 9e90bb4ea..d98ec1820 100644 --- a/builtin/providers/openstack/provider_test.go +++ b/builtin/providers/openstack/provider_test.go @@ -10,6 +10,7 @@ import ( var ( OS_REGION_NAME = "" + OS_POOL_NAME = "" ) var testAccProviders map[string]terraform.ResourceProvider @@ -49,6 +50,12 @@ func testAccPreCheck(t *testing.T) { t.Fatal("OS_IMAGE_ID must be set for acceptance tests") } + v = os.Getenv("OS_POOL_NAME") + if v == "" { + t.Fatal("OS_POOL_NAME must be set for acceptance tests") + } + OS_POOL_NAME = v + v = os.Getenv("OS_FLAVOR_ID") if v == "" { t.Fatal("OS_FLAVOR_ID must be set for acceptance tests") diff --git a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go index a5807100f..bcf30a6ee 100644 --- a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go +++ b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go @@ -224,7 +224,7 @@ func resourceComputeInstanceV2Create(d *schema.ResourceData, meta interface{}) e server.ID, err) } floatingIP := d.Get("floating_ip").(string) - if len(floatingIP) > 0 { + if floatingIP != "" { networkingClient, err := config.networkingV2Client(d.Get("region").(string)) if err != nil { return fmt.Errorf("Error creating OpenStack compute client: %s", err) @@ -401,7 +401,7 @@ func resourceComputeInstanceV2Update(d *schema.ResourceData, meta interface{}) e if d.HasChange("floating_ip") { floatingIP := d.Get("floating_ip").(string) - if len(floatingIP) > 0 { + if floatingIP != "" { networkingClient, err := config.networkingV2Client(d.Get("region").(string)) if err != nil { return fmt.Errorf("Error creating OpenStack compute client: %s", err) diff --git a/builtin/providers/openstack/resource_openstack_networking_floatingip_v2_test.go b/builtin/providers/openstack/resource_openstack_networking_floatingip_v2_test.go index 390275928..cd08ea512 100644 --- a/builtin/providers/openstack/resource_openstack_networking_floatingip_v2_test.go +++ b/builtin/providers/openstack/resource_openstack_networking_floatingip_v2_test.go @@ -84,6 +84,6 @@ func testAccCheckNetworkingV2FloatingIPExists(t *testing.T, n string, kp *floati var testAccNetworkingV2FloatingIP_basic = fmt.Sprintf(` resource "openstack_networking_floatingip_v2" "foo" { region = "%s" - pool = "PublicNetwork-01" + pool = "%s" }`, - OS_REGION_NAME) + OS_REGION_NAME, OS_POOL_NAME)