Skip to content

Commit

Permalink
Update cloud database timeout depending on operation
Browse files Browse the repository at this point in the history
  • Loading branch information
BellionBastien committed Jun 30, 2022
1 parent 117fd16 commit d0158f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ovh/resource_cloud_project_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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"},
Expand All @@ -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,
}
Expand Down

0 comments on commit d0158f4

Please sign in to comment.