From d0158f4a88cb0bfaa265cb5cbd55364acce7dc8a Mon Sep 17 00:00:00 2001 From: bbellion Date: Thu, 30 Jun 2022 17:07:15 +0200 Subject: [PATCH] Update cloud database timeout depending on operation --- ovh/resource_cloud_project_database.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ovh/resource_cloud_project_database.go b/ovh/resource_cloud_project_database.go index e2b499ad4..b27861286 100644 --- a/ovh/resource_cloud_project_database.go +++ b/ovh/resource_cloud_project_database.go @@ -205,7 +205,7 @@ func resourceCloudProjectDatabaseCreate(d *schema.ResourceData, meta interface{} } log.Printf("[DEBUG] Waiting for database %s to be READY", res.Id) - err = waitForCloudProjectDatabaseReady(config.OVHClient, serviceName, engine, res.Id) + err = waitForCloudProjectDatabaseReady(config.OVHClient, serviceName, engine, res.Id, 20*time.Minute) if err != nil { return fmt.Errorf("timeout while waiting database %s to be READY: %v", res.Id, err) } @@ -283,7 +283,7 @@ func resourceCloudProjectDatabaseUpdate(d *schema.ResourceData, meta interface{} } log.Printf("[DEBUG] Waiting for database %s to be READY", d.Id()) - err = waitForCloudProjectDatabaseReady(config.OVHClient, serviceName, engine, d.Id()) + err = waitForCloudProjectDatabaseReady(config.OVHClient, serviceName, engine, d.Id(), 40*time.Minute) if err != nil { return fmt.Errorf("timeout while waiting database %s to be READY: %v", d.Id(), err) } @@ -328,7 +328,7 @@ func cloudProjectDatabaseExists(serviceName, engine string, id string, client *o return client.Get(endpoint, res) } -func waitForCloudProjectDatabaseReady(client *ovh.Client, serviceName, engine string, databaseId string) error { +func waitForCloudProjectDatabaseReady(client *ovh.Client, serviceName, engine string, databaseId string, timeOut time.Duration) error { stateConf := &resource.StateChangeConf{ Pending: []string{"PENDING", "CREATING", "UPDATING"}, Target: []string{"READY"}, @@ -346,7 +346,7 @@ func waitForCloudProjectDatabaseReady(client *ovh.Client, serviceName, engine st return res, res.Status, nil }, - Timeout: 30 * time.Minute, + Timeout: timeOut, Delay: 30 * time.Second, MinTimeout: 10 * time.Second, }