File tree Expand file tree Collapse file tree 5 files changed +21
-12
lines changed Expand file tree Collapse file tree 5 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package regional
3
3
import (
4
4
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
5
5
"github.com/scaleway/scaleway-sdk-go/scw"
6
- "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality "
6
+ "github.com/scaleway/terraform-provider-scaleway/v2/internal/verify "
7
7
)
8
8
9
9
// ComputedSchema returns a standard schema for a region
@@ -32,6 +32,6 @@ func Schema() *schema.Schema {
32
32
Optional : true ,
33
33
ForceNew : true ,
34
34
Computed : true ,
35
- ValidateDiagFunc : locality .ValidateStringInSliceWithWarning (allRegions (), "region" ),
35
+ ValidateDiagFunc : verify .ValidateStringInSliceWithWarning (allRegions (), "region" ),
36
36
}
37
37
}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package zonal
3
3
import (
4
4
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
5
5
"github.com/scaleway/scaleway-sdk-go/scw"
6
- "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality "
6
+ "github.com/scaleway/terraform-provider-scaleway/v2/internal/verify "
7
7
)
8
8
9
9
// ComputedSchema returns a standard schema for a zone
@@ -32,6 +32,6 @@ func Schema() *schema.Schema {
32
32
Optional : true ,
33
33
ForceNew : true ,
34
34
Computed : true ,
35
- ValidateDiagFunc : locality .ValidateStringInSliceWithWarning (AllZones (), "zone" ),
35
+ ValidateDiagFunc : verify .ValidateStringInSliceWithWarning (AllZones (), "zone" ),
36
36
}
37
37
}
Original file line number Diff line number Diff line change @@ -64,11 +64,20 @@ func ResourceCluster() *schema.Resource {
64
64
Description : "The version of the cluster" ,
65
65
},
66
66
"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
+ var cniValues []k8s.CNI
73
+
74
+ cniStringValues := []string (nil )
75
+ for _ , cniValue := range cniValues {
76
+ cniStringValues = append (cniStringValues , cniValue .String ())
77
+ }
78
+
79
+ return verify .ValidateStringInSliceWithWarning (cniStringValues , "cni" )(i , p )
80
+ },
72
81
},
73
82
"tags" : {
74
83
Type : schema .TypeList ,
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ import (
10
10
"github.com/scaleway/scaleway-sdk-go/api/vpc/v2"
11
11
"github.com/scaleway/scaleway-sdk-go/scw"
12
12
"github.com/scaleway/terraform-provider-scaleway/v2/internal/httperrors"
13
- "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
14
13
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional"
15
14
"github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
16
15
"github.com/scaleway/terraform-provider-scaleway/v2/internal/meta"
17
16
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/account"
18
17
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
18
+ "github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
19
19
)
20
20
21
21
func ResourcePrivateNetwork () * schema.Resource {
@@ -172,7 +172,7 @@ func ResourcePrivateNetwork() *schema.Resource {
172
172
Optional : true ,
173
173
Computed : true ,
174
174
Deprecated : "This field is deprecated and will be removed in the next major version, please use `region` instead" ,
175
- ValidateDiagFunc : locality .ValidateStringInSliceWithWarning (zonal .AllZones (), "zone" ),
175
+ ValidateDiagFunc : verify .ValidateStringInSliceWithWarning (zonal .AllZones (), "zone" ),
176
176
},
177
177
"region" : regional .Schema (),
178
178
// Computed elements
Original file line number Diff line number Diff line change 1
- package locality
1
+ package verify
2
2
3
3
import (
4
4
"github.com/hashicorp/go-cty/cty"
You can’t perform that action at this time.
0 commit comments