|
8 | 8 |
|
9 | 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
10 | 10 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
| 11 | + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" |
11 | 12 | "github.com/xanzy/go-gitlab"
|
12 | 13 | )
|
13 | 14 |
|
@@ -38,15 +39,15 @@ func resourceGitlabProjectShareGroup() *schema.Resource {
|
38 | 39 | "group_access": {
|
39 | 40 | Description: fmt.Sprintf("The access level to grant the group for the project. Valid values are: %s", renderValueListForDocs(validProjectAccessLevelNames)),
|
40 | 41 | Type: schema.TypeString,
|
41 |
| - ValidateDiagFunc: validateValueFunc(validProjectAccessLevelNames), |
| 42 | + ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice(validProjectAccessLevelNames, false)), |
42 | 43 | ForceNew: true,
|
43 | 44 | Optional: true,
|
44 | 45 | ExactlyOneOf: []string{"access_level", "group_access"},
|
45 | 46 | },
|
46 | 47 | "access_level": {
|
47 | 48 | Description: fmt.Sprintf("The access level to grant the group for the project. Valid values are: %s", renderValueListForDocs(validProjectAccessLevelNames)),
|
48 | 49 | Type: schema.TypeString,
|
49 |
| - ValidateDiagFunc: validateValueFunc(validProjectAccessLevelNames), |
| 50 | + ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice(validProjectAccessLevelNames, false)), |
50 | 51 | ForceNew: true,
|
51 | 52 | Optional: true,
|
52 | 53 | Deprecated: "Use `group_access` instead of the `access_level` attribute.",
|
@@ -192,7 +193,7 @@ func resourceGitlabProjectShareGroupResourceV0() *schema.Resource {
|
192 | 193 | "access_level": {
|
193 | 194 | Description: fmt.Sprintf("The access level to grant the group for the project. Valid values are: %s", renderValueListForDocs(validProjectAccessLevelNames)),
|
194 | 195 | Type: schema.TypeString,
|
195 |
| - ValidateDiagFunc: validateValueFunc(validProjectAccessLevelNames), |
| 196 | + ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice(validProjectAccessLevelNames, false)), |
196 | 197 | ForceNew: true,
|
197 | 198 | Required: true,
|
198 | 199 | },
|
|
0 commit comments