Skip to content

Commit d75ae5e

Browse files
committed
fix(k8s): cni validation fail results in warning instead of error
1 parent 72998ac commit d75ae5e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

internal/services/k8s/cluster.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,18 @@ func ResourceCluster() *schema.Resource {
6464
Description: "The version of the cluster",
6565
},
6666
"cni": {
67-
Type: schema.TypeString,
68-
Required: true,
69-
ForceNew: true,
70-
Description: "The CNI plugin of the cluster",
71-
ValidateDiagFunc: verify.ValidateEnum[k8s.CNI](),
67+
Type: schema.TypeString,
68+
Required: true,
69+
ForceNew: true,
70+
Description: "The CNI plugin of the cluster",
71+
ValidateDiagFunc: func(i any, p cty.Path) diag.Diagnostics {
72+
cniValues := []string(nil)
73+
var values []k8s.CNI
74+
for _, cniValue := range values {
75+
cniValues = append(cniValues, cniValue.String())
76+
}
77+
return verify.ValidateStringInSliceWithWarning(cniValues, "cni")(i, p)
78+
},
7279
},
7380
"tags": {
7481
Type: schema.TypeList,

0 commit comments

Comments
 (0)