Skip to content

Commit c0b01c3

Browse files
committed
Fix
1 parent a59a5a1 commit c0b01c3

File tree

5 files changed

+85
-2
lines changed

5 files changed

+85
-2
lines changed

internal/services/k8s/acl_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@ func TestAccACL_RulesOrder(t *testing.T) {
209209
Steps: []resource.TestStep{
210210
{
211211
Config: fmt.Sprintf(`
212-
resource "scaleway_vpc_private_network" "acl_order" {}
212+
resource scaleway_vpc main {}
213+
214+
resource "scaleway_vpc_private_network" "acl_order" {
215+
vpc_id = scaleway_vpc.main.id
216+
}
213217
214218
resource "scaleway_k8s_cluster" "acl_order" {
215219
name = "%s"
@@ -261,7 +265,11 @@ func TestAccACL_RulesOrder(t *testing.T) {
261265
},
262266
{
263267
Config: fmt.Sprintf(`
264-
resource "scaleway_vpc_private_network" "acl_order" {}
268+
resource scaleway_vpc main {}
269+
270+
resource "scaleway_vpc_private_network" "acl_order" {
271+
vpc_id = scaleway_vpc.main.id
272+
}
265273
266274
resource "scaleway_k8s_cluster" "acl_order" {
267275
name = "%s"

internal/services/k8s/cluster_data_source_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ func TestAccDataSourceCluster_Basic(t *testing.T) {
2626
Steps: []resource.TestStep{
2727
{
2828
Config: fmt.Sprintf(`
29+
resource scaleway_vpc main {}
30+
2931
resource "scaleway_vpc_private_network" "main" {
3032
name = "test-data-source-cluster"
33+
vpc_id = scaleway_vpc.main.id
3134
}
3235
3336
resource "scaleway_k8s_cluster" "main" {

internal/services/k8s/cluster_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ func TestAccCluster_Basic(t *testing.T) {
109109
Steps: []resource.TestStep{
110110
{
111111
Config: fmt.Sprintf(`
112+
resource "scaleway_vpc" "main" {}
113+
112114
resource "scaleway_vpc_private_network" "minimal" {
113115
name = "test-minimal"
116+
vpc_id = scaleway_vpc.main.id
114117
}
118+
115119
resource "scaleway_k8s_cluster" "minimal" {
116120
cni = "calico"
117121
version = "%s"
@@ -140,9 +144,13 @@ resource "scaleway_k8s_cluster" "minimal" {
140144
},
141145
{
142146
Config: fmt.Sprintf(`
147+
resource scaleway_vpc main {}
148+
143149
resource "scaleway_vpc_private_network" "minimal" {
144150
name = "test-minimal"
151+
vpc_id = scaleway_vpc.main.id
145152
}
153+
146154
resource "scaleway_k8s_cluster" "minimal" {
147155
cni = "calico"
148156
version = "%s"
@@ -697,6 +705,7 @@ resource "scaleway_vpc_private_network" "autoscaler" {
697705
region = "nl-ams"
698706
vpc_id = scaleway_vpc.main.id
699707
}
708+
700709
resource "scaleway_k8s_cluster" "autoscaler" {
701710
cni = "calico"
702711
version = "%s"
@@ -720,9 +729,13 @@ resource "scaleway_k8s_cluster" "autoscaler" {
720729

721730
func testAccCheckK8SClusterConfigOIDC(version string) string {
722731
return fmt.Sprintf(`
732+
resource "scaleway_vpc" "main" {}
733+
723734
resource "scaleway_vpc_private_network" "oidc" {
724735
name = "test-oidc"
736+
vpc_id = scaleway_vpc.main.id
725737
}
738+
726739
resource "scaleway_k8s_cluster" "oidc" {
727740
cni = "cilium"
728741
version = "%s"
@@ -743,9 +756,13 @@ resource "scaleway_k8s_cluster" "oidc" {
743756

744757
func testAccCheckK8SClusterConfigOIDCChange(version string) string {
745758
return fmt.Sprintf(`
759+
resource "scaleway_vpc" "main" {}
760+
746761
resource "scaleway_vpc_private_network" "oidc" {
747762
name = "test-oidc"
763+
vpc_id = scaleway_vpc.main.id
748764
}
765+
749766
resource "scaleway_k8s_cluster" "oidc" {
750767
cni = "cilium"
751768
version = "%s"
@@ -766,9 +783,13 @@ resource "scaleway_k8s_cluster" "oidc" {
766783

767784
func testAccCheckK8SClusterAutoUpgrade(enable bool, day string, hour uint64, version string) string {
768785
return fmt.Sprintf(`
786+
resource "scaleway_vpc" "main" {}
787+
769788
resource "scaleway_vpc_private_network" "auto_upgrade" {
770789
name = "test-auto-upgrade"
790+
vpc_id = scaleway_vpc.main.id
771791
}
792+
772793
resource "scaleway_k8s_cluster" "auto_upgrade" {
773794
cni = "calico"
774795
version = "%s"
@@ -786,9 +807,13 @@ resource "scaleway_k8s_cluster" "auto_upgrade" {
786807

787808
func testAccCheckK8SClusterConfigPrivateNetworkLinked(version string) string {
788809
return fmt.Sprintf(`
810+
resource "scaleway_vpc" "main" {}
811+
789812
resource "scaleway_vpc_private_network" "private_network" {
790813
name = "k8s-private-network"
814+
vpc_id = scaleway_vpc.main.id
791815
}
816+
792817
resource "scaleway_k8s_cluster" "private_network" {
793818
cni = "calico"
794819
version = "%s"
@@ -802,12 +827,18 @@ resource "scaleway_k8s_cluster" "private_network" {
802827

803828
func testAccCheckK8SClusterConfigPrivateNetworkChange(version string) string {
804829
return fmt.Sprintf(`
830+
resource "scaleway_vpc" "main" {}
831+
805832
resource "scaleway_vpc_private_network" "private_network" {
806833
name = "k8s-private-network"
834+
vpc_id = scaleway_vpc.main.id
807835
}
836+
808837
resource "scaleway_vpc_private_network" "private_network_2" {
809838
name = "other-private-network"
839+
vpc_id = scaleway_vpc.main.id
810840
}
841+
811842
resource "scaleway_k8s_cluster" "private_network" {
812843
cni = "calico"
813844
version = "%s"
@@ -844,8 +875,11 @@ func testAccCheckK8SClusterTypeChange(clusterType, cni, version string) string {
844875

845876
if isKapsule {
846877
config = `
878+
resource "scaleway_vpc" "main" {}
879+
847880
resource "scaleway_vpc_private_network" "type-change" {
848881
name = "test-type-change"
882+
vpc_id = scaleway_vpc.main.id
849883
}`
850884
}
851885

internal/services/k8s/pool_data_source_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ func TestAccDataSourcePool_Basic(t *testing.T) {
2727
Steps: []resource.TestStep{
2828
{
2929
Config: fmt.Sprintf(`
30+
resource "scaleway_vpc" "main" {}
31+
3032
resource "scaleway_vpc_private_network" "main" {
3133
name = "test-data-source-pool"
34+
vpc_id = scaleway_vpc.main.id
3235
}
3336
3437
resource "scaleway_k8s_cluster" "main" {
@@ -50,8 +53,11 @@ func TestAccDataSourcePool_Basic(t *testing.T) {
5053
},
5154
{
5255
Config: fmt.Sprintf(`
56+
resource "scaleway_vpc" "main" {}
57+
5358
resource "scaleway_vpc_private_network" "main" {
5459
name = "test-data-source-pool"
60+
vpc_id = scaleway_vpc.main.id
5561
}
5662
5763
resource "scaleway_k8s_cluster" "main" {

internal/services/k8s/pool_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,13 @@ func TestAccPool_Size(t *testing.T) {
372372
Steps: []resource.TestStep{
373373
{
374374
Config: fmt.Sprintf(`
375+
resource "scaleway_vpc" "main" {}
376+
375377
resource "scaleway_vpc_private_network" "test-pool-size" {
376378
name = "test-pool-size"
379+
vpc_id = scaleway_vpc.main.id
377380
}
381+
378382
resource "scaleway_k8s_cluster" "test-pool-size" {
379383
name = "test-pool-size"
380384
version = "%s"
@@ -400,9 +404,13 @@ func TestAccPool_Size(t *testing.T) {
400404
},
401405
{
402406
Config: fmt.Sprintf(`
407+
resource "scaleway_vpc" "main" {}
408+
403409
resource "scaleway_vpc_private_network" "test-pool-size" {
404410
name = "test-pool-size"
411+
vpc_id = scaleway_vpc.main.id
405412
}
413+
406414
resource "scaleway_k8s_cluster" "test-pool-size" {
407415
name = "test-pool-size"
408416
version = "%s"
@@ -452,8 +460,11 @@ func TestAccPool_PublicIPDisabled(t *testing.T) {
452460
Steps: []resource.TestStep{
453461
{
454462
Config: fmt.Sprintf(`
463+
resource "scaleway_vpc" "main" {}
464+
455465
resource "scaleway_vpc_private_network" "public_ip" {
456466
name = "test-k8s-public-ip"
467+
vpc_id = scaleway_vpc.main.id
457468
}
458469
459470
resource "scaleway_k8s_cluster" "public_ip" {
@@ -485,8 +496,11 @@ func TestAccPool_PublicIPDisabled(t *testing.T) {
485496
},
486497
{
487498
Config: fmt.Sprintf(`
499+
resource "scaleway_vpc" "main" {}
500+
488501
resource "scaleway_vpc_private_network" "public_ip" {
489502
name = "test-k8s-public-ip"
503+
vpc_id = scaleway_vpc.main.id
490504
}
491505
492506
resource "scaleway_vpc_public_gateway" "public_ip" {
@@ -755,8 +769,11 @@ resource "scaleway_k8s_pool" "default" {
755769
tags = [ "terraform-test", "scaleway_k8s_cluster", "default" ]
756770
}
757771
772+
resource "scaleway_vpc" "main" {}
773+
758774
resource "scaleway_vpc_private_network" "minimal" {
759775
name = "test-pool-minimal"
776+
vpc_id = scaleway_vpc.main.id
760777
}
761778
762779
resource "scaleway_k8s_cluster" "minimal" {
@@ -797,8 +814,11 @@ resource "scaleway_k8s_pool" "default" {
797814
wait_for_pool_ready = true
798815
}
799816
817+
resource "scaleway_vpc" "main" {}
818+
800819
resource "scaleway_vpc_private_network" "minimal" {
801820
name = "test-pool-wait"
821+
vpc_id = scaleway_vpc.main.id
802822
}
803823
804824
resource "scaleway_k8s_cluster" "minimal" {
@@ -828,8 +848,11 @@ resource "scaleway_k8s_pool" "placement_group" {
828848
size = 1
829849
}
830850
851+
resource "scaleway_vpc" "main" {}
852+
831853
resource "scaleway_vpc_private_network" "placement_group" {
832854
name = "test-pool-placement-group"
855+
vpc_id = scaleway_vpc.main.id
833856
}
834857
835858
resource "scaleway_k8s_cluster" "placement_group" {
@@ -928,8 +951,11 @@ resource "scaleway_k8s_pool" "upgrade_policy" {
928951
}
929952
}
930953
954+
resource "scaleway_vpc" "main" {}
955+
931956
resource "scaleway_vpc_private_network" "upgrade_policy" {
932957
name = "test-pool-upgrade-policy"
958+
vpc_id = scaleway_vpc.main.id
933959
}
934960
935961
resource "scaleway_k8s_cluster" "upgrade_policy" {
@@ -957,8 +983,11 @@ resource "scaleway_k8s_pool" "kubelet_args" {
957983
}
958984
}
959985
986+
resource "scaleway_vpc" "main" {}
987+
960988
resource "scaleway_vpc_private_network" "kubelet_args" {
961989
name = "test-pool-kubelet-args"
990+
vpc_id = scaleway_vpc.main.id
962991
}
963992
964993
resource "scaleway_k8s_cluster" "kubelet_args" {
@@ -984,8 +1013,11 @@ resource "scaleway_k8s_pool" "zone" {
9841013
zone = "%s"
9851014
}
9861015
1016+
resource "scaleway_vpc" "main" {}
1017+
9871018
resource "scaleway_vpc_private_network" "zone" {
9881019
name = "test-pool-zone"
1020+
vpc_id = scaleway_vpc.main.id
9891021
}
9901022
9911023
resource "scaleway_k8s_cluster" "zone" {

0 commit comments

Comments
 (0)