@@ -22,10 +22,10 @@ func TestAccScalewayK8SCluster_PoolBasic(t *testing.T) {
22
22
PreCheck : func () { testAccPreCheck (t ) },
23
23
ProviderFactories : tt .ProviderFactories ,
24
24
CheckDestroy : resource .ComposeTestCheckFunc (
25
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
26
- testAccCheckScalewayK8SClusterDestroy (tt ),
27
25
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.default" ),
28
26
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.minimal" ),
27
+ testAccCheckScalewayK8SClusterDestroy (tt ),
28
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
29
29
),
30
30
Steps : []resource.TestStep {
31
31
{
@@ -42,6 +42,7 @@ func TestAccScalewayK8SCluster_PoolBasic(t *testing.T) {
42
42
resource .TestCheckResourceAttr ("scaleway_k8s_pool.default" , "tags.0" , "terraform-test" ),
43
43
resource .TestCheckResourceAttr ("scaleway_k8s_pool.default" , "tags.1" , "scaleway_k8s_cluster" ),
44
44
resource .TestCheckResourceAttr ("scaleway_k8s_pool.default" , "tags.2" , "default" ),
45
+ testAccCheckScalewayK8SPoolServersAreInPrivateNetwork (tt , "scaleway_k8s_cluster.minimal" , "scaleway_k8s_pool.default" , "scaleway_vpc_private_network.minimal" ),
45
46
),
46
47
},
47
48
{
@@ -58,13 +59,17 @@ func TestAccScalewayK8SCluster_PoolBasic(t *testing.T) {
58
59
resource .TestCheckResourceAttr ("scaleway_k8s_pool.minimal" , "tags.0" , "terraform-test" ),
59
60
resource .TestCheckResourceAttr ("scaleway_k8s_pool.minimal" , "tags.1" , "scaleway_k8s_cluster" ),
60
61
resource .TestCheckResourceAttr ("scaleway_k8s_pool.minimal" , "tags.2" , "minimal" ),
62
+ testAccCheckScalewayK8SPoolServersAreInPrivateNetwork (tt , "scaleway_k8s_cluster.minimal" , "scaleway_k8s_pool.default" , "scaleway_vpc_private_network.minimal" ),
63
+ testAccCheckScalewayK8SPoolServersAreInPrivateNetwork (tt , "scaleway_k8s_cluster.minimal" , "scaleway_k8s_pool.minimal" , "scaleway_vpc_private_network.minimal" ),
61
64
),
62
65
},
63
66
{
64
67
Config : testAccCheckScalewayK8SPoolConfigMinimal (latestK8SVersion , false ),
65
68
Check : resource .ComposeTestCheckFunc (
66
69
testAccCheckScalewayK8SClusterExists (tt , "scaleway_k8s_cluster.minimal" ),
70
+ testAccCheckScalewayK8SPoolExists (tt , "scaleway_k8s_pool.default" ),
67
71
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.minimal" ),
72
+ testAccCheckScalewayK8SPoolServersAreInPrivateNetwork (tt , "scaleway_k8s_cluster.minimal" , "scaleway_k8s_pool.default" , "scaleway_vpc_private_network.minimal" ),
68
73
),
69
74
},
70
75
},
@@ -79,10 +84,10 @@ func TestAccScalewayK8SCluster_PoolWait(t *testing.T) {
79
84
PreCheck : func () { testAccPreCheck (t ) },
80
85
ProviderFactories : tt .ProviderFactories ,
81
86
CheckDestroy : resource .ComposeTestCheckFunc (
82
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
83
- testAccCheckScalewayK8SClusterDestroy (tt ),
84
87
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.default" ),
85
88
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.minimal" ),
89
+ testAccCheckScalewayK8SClusterDestroy (tt ),
90
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
86
91
),
87
92
Steps : []resource.TestStep {
88
93
{
@@ -160,10 +165,10 @@ func TestAccScalewayK8SCluster_PoolPlacementGroup(t *testing.T) {
160
165
PreCheck : func () { testAccPreCheck (t ) },
161
166
ProviderFactories : tt .ProviderFactories ,
162
167
CheckDestroy : resource .ComposeTestCheckFunc (
163
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
164
- testAccCheckScalewayK8SClusterDestroy (tt ),
165
168
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.placement_group" ),
166
169
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.placement_group_2" ),
170
+ testAccCheckScalewayK8SClusterDestroy (tt ),
171
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
167
172
),
168
173
Steps : []resource.TestStep {
169
174
{
@@ -217,9 +222,9 @@ func TestAccScalewayK8SCluster_PoolUpgradePolicy(t *testing.T) {
217
222
PreCheck : func () { testAccPreCheck (t ) },
218
223
ProviderFactories : tt .ProviderFactories ,
219
224
CheckDestroy : resource .ComposeTestCheckFunc (
220
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
221
- testAccCheckScalewayK8SClusterDestroy (tt ),
222
225
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.upgrade_policy" ),
226
+ testAccCheckScalewayK8SClusterDestroy (tt ),
227
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
223
228
),
224
229
Steps : []resource.TestStep {
225
230
{
@@ -272,9 +277,9 @@ func TestAccScalewayK8SCluster_PoolKubeletArgs(t *testing.T) {
272
277
PreCheck : func () { testAccPreCheck (t ) },
273
278
ProviderFactories : tt .ProviderFactories ,
274
279
CheckDestroy : resource .ComposeTestCheckFunc (
275
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
276
- testAccCheckScalewayK8SClusterDestroy (tt ),
277
280
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.kubelet_args" ),
281
+ testAccCheckScalewayK8SClusterDestroy (tt ),
282
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
278
283
),
279
284
Steps : []resource.TestStep {
280
285
{
@@ -311,9 +316,9 @@ func TestAccScalewayK8SCluster_PoolZone(t *testing.T) {
311
316
PreCheck : func () { testAccPreCheck (t ) },
312
317
ProviderFactories : tt .ProviderFactories ,
313
318
CheckDestroy : resource .ComposeTestCheckFunc (
314
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
315
- testAccCheckScalewayK8SClusterDestroy (tt ),
316
319
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.zone" ),
320
+ testAccCheckScalewayK8SClusterDestroy (tt ),
321
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
317
322
),
318
323
Steps : []resource.TestStep {
319
324
{
@@ -340,9 +345,9 @@ func TestAccScalewayK8SCluster_PoolSize(t *testing.T) {
340
345
PreCheck : func () { testAccPreCheck (t ) },
341
346
ProviderFactories : tt .ProviderFactories ,
342
347
CheckDestroy : resource .ComposeTestCheckFunc (
343
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
344
- testAccCheckScalewayK8SClusterDestroy (tt ),
345
348
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.pool" ),
349
+ testAccCheckScalewayK8SClusterDestroy (tt ),
350
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
346
351
),
347
352
Steps : []resource.TestStep {
348
353
{
@@ -407,63 +412,6 @@ func TestAccScalewayK8SCluster_PoolSize(t *testing.T) {
407
412
})
408
413
}
409
414
410
- func TestAccScalewayK8SCluster_PoolPrivateNetwork (t * testing.T ) {
411
- tt := NewTestTools (t )
412
- defer tt .Cleanup ()
413
-
414
- latestK8SVersion := testAccScalewayK8SClusterGetLatestK8SVersion (tt )
415
-
416
- resource .ParallelTest (t , resource.TestCase {
417
- PreCheck : func () { testAccPreCheck (t ) },
418
- ProviderFactories : tt .ProviderFactories ,
419
- CheckDestroy : resource .ComposeTestCheckFunc (
420
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
421
- testAccCheckScalewayK8SClusterDestroy (tt ),
422
- testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.pool_with_pn" ),
423
- ),
424
- Steps : []resource.TestStep {
425
- {
426
- Config : fmt .Sprintf (`
427
- resource "scaleway_vpc" "vpc" {
428
- name = "test-k8s-private-network"
429
- }
430
- resource "scaleway_vpc_private_network" "pn" {
431
- name = "test-k8s-private-network"
432
- vpc_id = scaleway_vpc.vpc.id
433
- }
434
-
435
- resource "scaleway_k8s_cluster" "cluster_with_pn" {
436
- name = "test-k8s-private-network"
437
- version = "%s"
438
- cni = "cilium"
439
- private_network_id = scaleway_vpc_private_network.pn.id
440
- tags = [ "terraform-test", "scaleway_k8s_cluster", "private_network" ]
441
- delete_additional_resources = true
442
- depends_on = [scaleway_vpc_private_network.pn]
443
- }
444
-
445
- resource "scaleway_k8s_pool" "pool_with_pn" {
446
- cluster_id = scaleway_k8s_cluster.cluster_with_pn.id
447
- name = "pool"
448
- node_type = "gp1_xs"
449
- size = 2
450
- autoscaling = false
451
- autohealing = true
452
- wait_for_pool_ready = true
453
- depends_on = [scaleway_vpc_private_network.pn]
454
- }` , latestK8SVersion ),
455
- Check : resource .ComposeTestCheckFunc (
456
- testAccCheckScalewayK8SClusterExists (tt , "scaleway_k8s_cluster.cluster_with_pn" ),
457
- testAccCheckScalewayVPCPrivateNetworkExists (tt , "scaleway_vpc_private_network.pn" ),
458
- testAccCheckScalewayK8SPoolExists (tt , "scaleway_k8s_pool.pool_with_pn" ),
459
- testAccCheckScalewayK8sClusterPrivateNetworkID (tt , "scaleway_k8s_cluster.cluster_with_pn" , "scaleway_vpc_private_network.pn" ),
460
- testAccCheckScalewayK8SPoolServersAreInPrivateNetwork (tt , "scaleway_k8s_cluster.cluster_with_pn" , "scaleway_k8s_pool.pool_with_pn" , "scaleway_vpc_private_network.pn" ),
461
- ),
462
- },
463
- },
464
- })
465
- }
466
-
467
415
func TestAccScalewayK8SCluster_PoolPublicIPDisabled (t * testing.T ) {
468
416
tt := NewTestTools (t )
469
417
defer tt .Cleanup ()
@@ -474,12 +422,12 @@ func TestAccScalewayK8SCluster_PoolPublicIPDisabled(t *testing.T) {
474
422
PreCheck : func () { testAccPreCheck (t ) },
475
423
ProviderFactories : tt .ProviderFactories ,
476
424
CheckDestroy : resource .ComposeTestCheckFunc (
477
- testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
478
- testAccCheckScalewayVPCPublicGatewayDestroy (tt ),
479
- testAccCheckScalewayVPCPublicGatewayDHCPDestroy (tt ),
480
- testAccCheckScalewayVPCGatewayNetworkDestroy (tt ),
481
- testAccCheckScalewayK8SClusterDestroy (tt ),
482
425
testAccCheckScalewayK8SPoolDestroy (tt , "scaleway_k8s_pool.public_ip" ),
426
+ testAccCheckScalewayK8SClusterDestroy (tt ),
427
+ testAccCheckScalewayVPCGatewayNetworkDestroy (tt ),
428
+ testAccCheckScalewayVPCPublicGatewayDHCPDestroy (tt ),
429
+ testAccCheckScalewayVPCPublicGatewayDestroy (tt ),
430
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
483
431
),
484
432
Steps : []resource.TestStep {
485
433
{
0 commit comments