@@ -249,6 +249,66 @@ func TestAccScalewayK8SClusterBetaDefaultPoolRecreate(t *testing.T) {
249
249
})
250
250
}
251
251
252
+ func TestAccScalewayK8SClusterBetaDefaultPoolWait (t * testing.T ) {
253
+ resource .ParallelTest (t , resource.TestCase {
254
+ PreCheck : func () { testAccPreCheck (t ) },
255
+ Providers : testAccProviders ,
256
+ CheckDestroy : testAccCheckScalewayK8SClusterBetaDestroy ,
257
+ Steps : []resource.TestStep {
258
+ {
259
+ Config : testAccCheckScalewayK8SClusterBetaConfigPoolWait ("1.17.3" , 1 ),
260
+ Check : resource .ComposeTestCheckFunc (
261
+ testAccCheckScalewayK8SClusterBetaExists ("scaleway_k8s_cluster_beta.pool" ),
262
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "version" , "1.17.3" ),
263
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "cni" , "cilium" ),
264
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "status" , k8s .ClusterStatusReady .String ()),
265
+ resource .TestCheckResourceAttrSet ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.pool_id" ),
266
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.size" , "1" ),
267
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.node_type" , "gp1_xs" ),
268
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.min_size" , "1" ),
269
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.max_size" , "1" ),
270
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.status" , k8s .PoolStatusReady .String ()),
271
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.nodes.0.status" , k8s .NodeStatusReady .String ()),
272
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.wait_for_pool_ready" , "true" ),
273
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "tags.0" , "terraform-test" ),
274
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "tags.1" , "scaleway_k8s_cluster_beta" ),
275
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "tags.2" , "default-pool" ),
276
+ ),
277
+ },
278
+ {
279
+ Config : testAccCheckScalewayK8SClusterBetaConfigPoolWait ("1.17.3" , 2 ), // add a node and wait for the pool to be ready
280
+ Check : resource .ComposeTestCheckFunc (
281
+ testAccCheckScalewayK8SClusterBetaExists ("scaleway_k8s_cluster_beta.pool" ),
282
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "status" , k8s .ClusterStatusReady .String ()),
283
+ resource .TestCheckResourceAttrSet ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.pool_id" ),
284
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.size" , "2" ),
285
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.min_size" , "1" ),
286
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.max_size" , "2" ),
287
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.status" , k8s .PoolStatusReady .String ()),
288
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.nodes.0.status" , k8s .NodeStatusReady .String ()),
289
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.nodes.1.status" , k8s .NodeStatusReady .String ()), // check that the new node has the "ready" status
290
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.wait_for_pool_ready" , "true" ),
291
+ ),
292
+ },
293
+ {
294
+ Config : testAccCheckScalewayK8SClusterBetaConfigPoolWait ("1.17.3" , 1 ), // remove a node and wait for the pool to be ready
295
+ Check : resource .ComposeTestCheckFunc (
296
+ testAccCheckScalewayK8SClusterBetaExists ("scaleway_k8s_cluster_beta.pool" ),
297
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "status" , k8s .ClusterStatusReady .String ()),
298
+ resource .TestCheckResourceAttrSet ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.pool_id" ),
299
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.size" , "1" ),
300
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.min_size" , "1" ),
301
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.max_size" , "1" ),
302
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.status" , k8s .PoolStatusReady .String ()),
303
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.nodes.0.status" , k8s .NodeStatusReady .String ()),
304
+ resource .TestCheckNoResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.nodes.1" ), // check that the second node does not exist anymore
305
+ resource .TestCheckResourceAttr ("scaleway_k8s_cluster_beta.pool" , "default_pool.0.wait_for_pool_ready" , "true" ),
306
+ ),
307
+ },
308
+ },
309
+ })
310
+ }
311
+
252
312
func TestAccScalewayK8SClusterBetaAutoUpgrade (t * testing.T ) {
253
313
resource .ParallelTest (t , resource.TestCase {
254
314
PreCheck : func () { testAccPreCheck (t ) },
@@ -411,6 +471,24 @@ resource "scaleway_k8s_cluster_beta" "pool" {
411
471
}` , version )
412
472
}
413
473
474
+ func testAccCheckScalewayK8SClusterBetaConfigPoolWait (version string , size int ) string {
475
+ return fmt .Sprintf (`
476
+ resource "scaleway_k8s_cluster_beta" "pool" {
477
+ cni = "cilium"
478
+ version = "%s"
479
+ name = "default-pool"
480
+ default_pool {
481
+ node_type = "gp1_xs"
482
+ size = %d
483
+ min_size = 1
484
+ max_size = %d
485
+ container_runtime = "docker"
486
+ wait_for_pool_ready = true
487
+ }
488
+ tags = [ "terraform-test", "scaleway_k8s_cluster_beta", "default-pool" ]
489
+ }` , version , size , size )
490
+ }
491
+
414
492
func testAccCheckScalewayK8SClusterBetaConfigPoolWithPlacementGroup (version string ) string {
415
493
return fmt .Sprintf (`
416
494
resource "scaleway_instance_placement_group" "pool_placement_group" {
0 commit comments