diff --git a/builtin/providers/openstack/resource_openstack_lb_member_v2.go b/builtin/providers/openstack/resource_openstack_lb_member_v2.go index 3df218235..9145fcc0e 100644 --- a/builtin/providers/openstack/resource_openstack_lb_member_v2.go +++ b/builtin/providers/openstack/resource_openstack_lb_member_v2.go @@ -117,7 +117,25 @@ func resourceMemberV2Create(d *schema.ResourceData, meta interface{}) error { poolID := d.Get("pool_id").(string) log.Printf("[DEBUG] Create Options: %#v", createOpts) - member, err := pools.CreateMember(networkingClient, poolID, createOpts).Extract() + + var member *pools.Member + err = resource.Retry(10*time.Minute, func() *resource.RetryError { + var err error + log.Printf("[DEBUG] Attempting to create LBaaSV2 member") + member, err = pools.CreateMember(networkingClient, poolID, createOpts).Extract() + if err != nil { + if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok { + if errCode.Actual == 409 || errCode.Actual == 500 { + log.Printf("[DEBUG] OpenStack LBaaSV2 member is still creating.") + return resource.RetryableError(err) + } + } + return resource.NonRetryableError(err) + } + + return nil + }) + if err != nil { return fmt.Errorf("Error creating OpenStack LBaaSV2 member: %s", err) } @@ -261,7 +279,7 @@ func waitForMemberDelete(networkingClient *gophercloud.ServiceClient, poolID str if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok { if errCode.Actual == 409 { log.Printf("[DEBUG] OpenStack LBaaSV2 Member (%s) is still in use.", memberID) - return member, "ACTIVE", nil + return member, "PENDING_DELETE", nil } }