@@ -206,7 +206,6 @@ func getConfig(kubernetesVersion, nodePoolMachineOSVersion string, maintenanceEn
206206}
207207
208208func TestAccSKE (t * testing.T ) {
209- testRegion := utils .Ptr ("eu01" )
210209 resource .Test (t , resource.TestCase {
211210 ProtoV6ProviderFactories : testutil .TestAccProtoV6ProviderFactories ,
212211 CheckDestroy : testAccCheckSKEDestroy ,
@@ -215,7 +214,7 @@ func TestAccSKE(t *testing.T) {
215214 // 1) Creation
216215 {
217216
218- Config : getConfig (clusterResource ["kubernetes_version_min" ], clusterResource ["nodepool_os_version_min" ], nil , testRegion ),
217+ Config : getConfig (clusterResource ["kubernetes_version_min" ], clusterResource ["nodepool_os_version_min" ], nil , & testutil . Region ),
219218 Check : resource .ComposeAggregateTestCheckFunc (
220219 // cluster data
221220 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "name" , clusterResource ["name" ]),
@@ -257,7 +256,7 @@ func TestAccSKE(t *testing.T) {
257256 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "maintenance.enable_machine_image_version_updates" , clusterResource ["maintenance_enable_machine_image_version_updates" ]),
258257 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "maintenance.start" , clusterResource ["maintenance_start" ]),
259258 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "maintenance.end" , clusterResource ["maintenance_end" ]),
260- resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "region" , * testRegion ),
259+ resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "region" , testutil . Region ),
261260
262261 // Kubeconfig
263262
@@ -285,7 +284,7 @@ func TestAccSKE(t *testing.T) {
285284 }
286285
287286 ` ,
288- getConfig (clusterResource ["kubernetes_version_min" ], clusterResource ["nodepool_os_version_min" ], nil , testRegion ),
287+ getConfig (clusterResource ["kubernetes_version_min" ], clusterResource ["nodepool_os_version_min" ], nil , & testutil . Region ),
289288 clusterResource ["project_id" ],
290289 clusterResource ["name" ],
291290 ),
@@ -294,7 +293,7 @@ func TestAccSKE(t *testing.T) {
294293 // cluster data
295294 resource .TestCheckResourceAttr ("data.stackit_ske_cluster.cluster" , "id" , fmt .Sprintf ("%s,%s,%s" ,
296295 clusterResource ["project_id" ],
297- * testRegion ,
296+ testutil . Region ,
298297 clusterResource ["name" ],
299298 )),
300299 resource .TestCheckResourceAttr ("data.stackit_ske_cluster.cluster" , "project_id" , clusterResource ["project_id" ]),
@@ -357,7 +356,7 @@ func TestAccSKE(t *testing.T) {
357356 },
358357 // 4) Update kubernetes version, OS version and maintenance end
359358 {
360- Config : getConfig (clusterResource ["kubernetes_version_min_new" ], clusterResource ["nodepool_os_version_min_new" ], utils .Ptr (clusterResource ["maintenance_end_new" ]), testRegion ),
359+ Config : getConfig (clusterResource ["kubernetes_version_min_new" ], clusterResource ["nodepool_os_version_min_new" ], utils .Ptr (clusterResource ["maintenance_end_new" ]), & testutil . Region ),
361360 Check : resource .ComposeAggregateTestCheckFunc (
362361 // cluster data
363362 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "project_id" , clusterResource ["project_id" ]),
@@ -399,12 +398,12 @@ func TestAccSKE(t *testing.T) {
399398 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "maintenance.enable_machine_image_version_updates" , clusterResource ["maintenance_enable_machine_image_version_updates" ]),
400399 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "maintenance.start" , clusterResource ["maintenance_start" ]),
401400 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "maintenance.end" , clusterResource ["maintenance_end_new" ]),
402- resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "region" , * testRegion ),
401+ resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "region" , testutil . Region ),
403402 ),
404403 },
405404 // 5) Downgrade kubernetes and nodepool machine OS version
406405 {
407- Config : getConfig (clusterResource ["kubernetes_version_min" ], clusterResource ["nodepool_os_version_min" ], utils .Ptr (clusterResource ["maintenance_end_new" ]), testRegion ),
406+ Config : getConfig (clusterResource ["kubernetes_version_min" ], clusterResource ["nodepool_os_version_min" ], utils .Ptr (clusterResource ["maintenance_end_new" ]), & testutil . Region ),
408407 Check : resource .ComposeAggregateTestCheckFunc (
409408 // cluster data
410409 resource .TestCheckResourceAttr ("stackit_ske_cluster.cluster" , "project_id" , clusterResource ["project_id" ]),
@@ -443,7 +442,7 @@ func testAccCheckSKEDestroy(s *terraform.State) error {
443442 continue
444443 }
445444 // cluster terraform ID: = "[project_id],[region],[cluster_name]"
446- clusterName := strings .Split (rs .Primary .ID , core .Separator )[1 ]
445+ clusterName := strings .Split (rs .Primary .ID , core .Separator )[2 ]
447446 clustersToDestroy = append (clustersToDestroy , clusterName )
448447 }
449448
0 commit comments