Skip to content

Commit

Permalink
fix(k8s_cluster): removing description (#2871)
Browse files Browse the repository at this point in the history
  • Loading branch information
Codelax authored Jan 14, 2025
1 parent 4dda9fb commit 7c34968
Show file tree
Hide file tree
Showing 3 changed files with 363 additions and 349 deletions.
2 changes: 1 addition & 1 deletion internal/services/k8s/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ func ResourceK8SClusterUpdate(ctx context.Context, d *schema.ResourceData, m int
}

if d.HasChange("description") {
updateRequest.Description = types.ExpandStringPtr(d.Get("description"))
updateRequest.Description = types.ExpandUpdatedStringPtr(d.Get("description"))
}

if d.HasChange("tags") {
Expand Down
44 changes: 27 additions & 17 deletions internal/services/k8s/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,19 @@ func TestAccCluster_Basic(t *testing.T) {
),
Steps: []resource.TestStep{
{
Config: testAccCheckK8SClusterConfigMinimal(previousK8SVersion),
Config: fmt.Sprintf(`
resource "scaleway_vpc_private_network" "minimal" {
name = "test-minimal"
}
resource "scaleway_k8s_cluster" "minimal" {
cni = "calico"
version = "%s"
name = "test-minimal"
tags = [ "terraform-test", "scaleway_k8s_cluster", "minimal" ]
delete_additional_resources = false
private_network_id = scaleway_vpc_private_network.minimal.id
description = "terraform basic test cluster"
}`, previousK8SVersion),
Check: resource.ComposeTestCheckFunc(
testAccCheckK8SClusterExists(tt, "scaleway_k8s_cluster.minimal"),
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "version", previousK8SVersion),
Expand All @@ -102,10 +114,22 @@ func TestAccCluster_Basic(t *testing.T) {
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "tags.0", "terraform-test"),
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "tags.1", "scaleway_k8s_cluster"),
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "tags.2", "minimal"),
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "description", "terraform basic test cluster"),
),
},
{
Config: testAccCheckK8SClusterConfigMinimal(latestK8SVersion),
Config: fmt.Sprintf(`
resource "scaleway_vpc_private_network" "minimal" {
name = "test-minimal"
}
resource "scaleway_k8s_cluster" "minimal" {
cni = "calico"
version = "%s"
name = "test-minimal"
tags = [ "terraform-test", "scaleway_k8s_cluster", "minimal" ]
delete_additional_resources = false
private_network_id = scaleway_vpc_private_network.minimal.id
}`, latestK8SVersion),
Check: resource.ComposeTestCheckFunc(
testAccCheckK8SClusterExists(tt, "scaleway_k8s_cluster.minimal"),
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "version", latestK8SVersion),
Expand All @@ -120,6 +144,7 @@ func TestAccCluster_Basic(t *testing.T) {
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "tags.0", "terraform-test"),
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "tags.1", "scaleway_k8s_cluster"),
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "tags.2", "minimal"),
resource.TestCheckResourceAttr("scaleway_k8s_cluster.minimal", "description", ""),
),
},
},
Expand Down Expand Up @@ -600,21 +625,6 @@ func testAccCheckK8sClusterPrivateNetworkID(tt *acctest.TestTools, clusterName,
}
}

func testAccCheckK8SClusterConfigMinimal(version string) string {
return fmt.Sprintf(`
resource "scaleway_vpc_private_network" "minimal" {
name = "test-minimal"
}
resource "scaleway_k8s_cluster" "minimal" {
cni = "calico"
version = "%s"
name = "test-minimal"
tags = [ "terraform-test", "scaleway_k8s_cluster", "minimal" ]
delete_additional_resources = false
private_network_id = scaleway_vpc_private_network.minimal.id
}`, version)
}

func testAccCheckK8SClusterConfigAutoscaler(version string) string {
return fmt.Sprintf(`
resource "scaleway_vpc_private_network" "autoscaler" {
Expand Down
Loading

0 comments on commit 7c34968

Please sign in to comment.