Skip to content
Merged
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
4 changes: 2 additions & 2 deletions internal/locality/regional/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package regional
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
)

// ComputedSchema returns a standard schema for a region
Expand Down Expand Up @@ -32,6 +32,6 @@ func Schema() *schema.Schema {
Optional: true,
ForceNew: true,
Computed: true,
ValidateDiagFunc: locality.ValidateStringInSliceWithWarning(allRegions(), "region"),
ValidateDiagFunc: verify.ValidateStringInSliceWithWarning(allRegions(), "region"),
}
}
4 changes: 2 additions & 2 deletions internal/locality/zonal/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package zonal
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
)

// ComputedSchema returns a standard schema for a zone
Expand Down Expand Up @@ -32,6 +32,6 @@ func Schema() *schema.Schema {
Optional: true,
ForceNew: true,
Computed: true,
ValidateDiagFunc: locality.ValidateStringInSliceWithWarning(AllZones(), "zone"),
ValidateDiagFunc: verify.ValidateStringInSliceWithWarning(AllZones(), "zone"),
}
}
19 changes: 14 additions & 5 deletions internal/services/k8s/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,20 @@ func ResourceCluster() *schema.Resource {
Description: "The version of the cluster",
},
"cni": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The CNI plugin of the cluster",
ValidateDiagFunc: verify.ValidateEnum[k8s.CNI](),
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The CNI plugin of the cluster",
ValidateDiagFunc: func(i any, p cty.Path) diag.Diagnostics {
var cniValues []k8s.CNI

cniStringValues := []string(nil)
for _, cniValue := range cniValues {
cniStringValues = append(cniStringValues, cniValue.String())
}

return verify.ValidateStringInSliceWithWarning(cniStringValues, "cni")(i, p)
},
},
"tags": {
Type: schema.TypeList,
Expand Down
4 changes: 2 additions & 2 deletions internal/services/vpc/private_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"github.com/scaleway/scaleway-sdk-go/api/vpc/v2"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/httperrors"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/meta"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/account"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
)

func ResourcePrivateNetwork() *schema.Resource {
Expand Down Expand Up @@ -172,7 +172,7 @@ func ResourcePrivateNetwork() *schema.Resource {
Optional: true,
Computed: true,
Deprecated: "This field is deprecated and will be removed in the next major version, please use `region` instead",
ValidateDiagFunc: locality.ValidateStringInSliceWithWarning(zonal.AllZones(), "zone"),
ValidateDiagFunc: verify.ValidateStringInSliceWithWarning(zonal.AllZones(), "zone"),
},
"region": regional.Schema(),
// Computed elements
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package locality
package verify

import (
"github.com/hashicorp/go-cty/cty"
Expand Down
Loading