@@ -181,11 +181,18 @@ func (s *API) WaitForClusterPool(req *WaitForClusterRequest, opts ...scw.Request
181181 retryInterval = * req .RetryInterval
182182 }
183183
184- terminalStatus := map [ClusterStatus ]struct {}{
184+ terminalClusterStatus := map [ClusterStatus ]struct {}{
185185 ClusterStatusPoolRequired : {},
186186 ClusterStatusReady : {},
187187 }
188188
189+ terminalPoolStatus := map [PoolStatus ]struct {}{
190+ PoolStatusReady : {},
191+ PoolStatusWarning : {},
192+ }
193+
194+ optsWithAllPages := append (opts , scw .WithAllPages ())
195+
189196 cluster , err := async .WaitSync (& async.WaitSyncConfig {
190197 Get : func () (interface {}, bool , error ) {
191198 cluster , err := s .GetCluster (& GetClusterRequest {
@@ -196,8 +203,27 @@ func (s *API) WaitForClusterPool(req *WaitForClusterRequest, opts ...scw.Request
196203 return nil , false , err
197204 }
198205
199- _ , isTerminal := terminalStatus [cluster .Status ]
200- return cluster , isTerminal , nil
206+ _ , isTerminal := terminalClusterStatus [cluster .Status ]
207+ if ! isTerminal {
208+ return cluster , false , nil
209+ }
210+
211+ pools , err := s .ListPools (& ListPoolsRequest {
212+ Region : req .Region ,
213+ ClusterID : req .ClusterID ,
214+ }, optsWithAllPages ... )
215+ if err != nil {
216+ return nil , false , err
217+ }
218+
219+ for _ , pool := range pools .Pools {
220+ _ , isTerminal = terminalPoolStatus [pool .Status ]
221+ if ! isTerminal {
222+ return cluster , false , nil
223+ }
224+ }
225+
226+ return cluster , true , nil
201227 },
202228 Timeout : timeout ,
203229 IntervalStrategy : async .LinearIntervalStrategy (retryInterval ),
0 commit comments