Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema {
string(agentpools.OSSKUAzureLinuxThree),
string(agentpools.OSSKUUbuntu),
string(agentpools.OSSKUUbuntuTwoTwoZeroFour),
string(agentpools.OSSKUUbuntuTwoFourZeroFour),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be added to the documentation for azurerm_kubernetes_cluster_node_pool

string(agentpools.OSSKUWindowsTwoZeroOneNine),
string(agentpools.OSSKUWindowsTwoZeroTwoTwo),
}, false),
Expand Down
1 change: 1 addition & 0 deletions internal/services/containers/kubernetes_nodepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func SchemaDefaultNodePool() *pluginsdk.Schema {
string(agentpools.OSSKUAzureLinuxThree),
string(agentpools.OSSKUUbuntu),
string(agentpools.OSSKUUbuntuTwoTwoZeroFour),
string(agentpools.OSSKUUbuntuTwoFourZeroFour),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be added to the documentation for azurerm_kubernetes_cluster

string(agentpools.OSSKUWindowsTwoZeroOneNine),
string(agentpools.OSSKUWindowsTwoZeroTwoTwo),
}, false),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright IBM Corp. 2014, 2025
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed, we don't unit test basic ValidateFuncs like validation.StringInSlice

// SPDX-License-Identifier: MPL-2.0

package containers

import (
"testing"

"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
)

func TestKubernetesClusterNodePoolSchemaAcceptsUbuntu2404(t *testing.T) {
validate := resourceKubernetesClusterNodePoolSchema()["os_sku"].ValidateFunc
if validate == nil {
t.Fatal("node pool os_sku ValidateFunc is nil")
}

if warnings, errs := validate("Ubuntu2404", "os_sku"); len(warnings) != 0 || len(errs) != 0 {
t.Fatalf("expected Ubuntu2404 to be accepted for node pool os_sku, got warnings=%v errs=%v", warnings, errs)
}
}

func TestKubernetesClusterDefaultNodePoolSchemaAcceptsUbuntu2404(t *testing.T) {
defaultNodePool := resourceKubernetesCluster().Schema["default_node_pool"]
if defaultNodePool == nil {
t.Fatal("default_node_pool schema is nil")
}

defaultNodePoolResource, ok := defaultNodePool.Elem.(*pluginsdk.Resource)
if !ok {
t.Fatalf("expected default_node_pool elem to be a resource, got %T", defaultNodePool.Elem)
}

validate := defaultNodePoolResource.Schema["os_sku"].ValidateFunc
if validate == nil {
t.Fatal("default node pool os_sku ValidateFunc is nil")
}

if warnings, errs := validate("Ubuntu2404", "os_sku"); len(warnings) != 0 || len(errs) != 0 {
t.Fatalf("expected Ubuntu2404 to be accepted for default node pool os_sku, got warnings=%v errs=%v", warnings, errs)
}
}
Loading