Skip to content

Commit 6463d2f

Browse files
committed
Convert all usage of deprecated ValidateFunc to ValidateDiagFunc
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
1 parent ecd4b0d commit 6463d2f

4 files changed

Lines changed: 28 additions & 28 deletions

github/resource_github_actions_hosted_runner.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ func resourceGithubActionsHostedRunner() *schema.Resource {
3434
"name": {
3535
Type: schema.TypeString,
3636
Required: true,
37-
ValidateFunc: validation.All(
37+
ValidateDiagFunc: validation.ToDiagFunc(validation.All(
3838
validation.StringLenBetween(1, 64),
3939
validation.StringMatch(
4040
regexp.MustCompile(`^[a-zA-Z0-9._-]+$`),
4141
"name may only contain alphanumeric characters, '.', '-', and '_'",
4242
),
43-
),
43+
)),
4444
Description: "Name of the hosted runner. Must be between 1 and 64 characters and may only contain upper and lowercase letters a-z, numbers 0-9, '.', '-', and '_'.",
4545
},
4646
"image": {
@@ -56,11 +56,11 @@ func resourceGithubActionsHostedRunner() *schema.Resource {
5656
Description: "The image ID.",
5757
},
5858
"source": {
59-
Type: schema.TypeString,
60-
Optional: true,
61-
Default: "github",
62-
ValidateFunc: validation.StringInSlice([]string{"github", "partner", "custom"}, false),
63-
Description: "The image source (github, partner, or custom).",
59+
Type: schema.TypeString,
60+
Optional: true,
61+
Default: "github",
62+
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"github", "partner", "custom"}, false)),
63+
Description: "The image source (github, partner, or custom).",
6464
},
6565
"size_gb": {
6666
Type: schema.TypeInt,
@@ -82,11 +82,11 @@ func resourceGithubActionsHostedRunner() *schema.Resource {
8282
Description: "The runner group ID.",
8383
},
8484
"maximum_runners": {
85-
Type: schema.TypeInt,
86-
Optional: true,
87-
Computed: true,
88-
ValidateFunc: validation.IntAtLeast(1),
89-
Description: "Maximum number of runners to scale up to.",
85+
Type: schema.TypeInt,
86+
Optional: true,
87+
Computed: true,
88+
ValidateDiagFunc: validation.ToDiagFunc(validation.IntAtLeast(1)),
89+
Description: "Maximum number of runners to scale up to.",
9090
},
9191
"public_ip_enabled": {
9292
Type: schema.TypeBool,

github/resource_github_actions_organization_workflow_permissions.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ func resourceGithubActionsOrganizationWorkflowPermissions() *schema.Resource {
4141
Description: "The slug of the Organization.",
4242
},
4343
"default_workflow_permissions": {
44-
Type: schema.TypeString,
45-
Optional: true,
46-
Default: "read",
47-
Description: "The default workflow permissions granted to the GITHUB_TOKEN when running workflows in any repository in the organization. Can be 'read' or 'write'.",
48-
ValidateFunc: validation.StringInSlice([]string{"read", "write"}, false),
44+
Type: schema.TypeString,
45+
Optional: true,
46+
Default: "read",
47+
Description: "The default workflow permissions granted to the GITHUB_TOKEN when running workflows in any repository in the organization. Can be 'read' or 'write'.",
48+
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"read", "write"}, false)),
4949
},
5050
"can_approve_pull_request_reviews": {
5151
Type: schema.TypeBool,

github/resource_github_enterprise_actions_workflow_permissions.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ func resourceGithubEnterpriseActionsWorkflowPermissions() *schema.Resource {
2828
Description: "The slug of the enterprise.",
2929
},
3030
"default_workflow_permissions": {
31-
Type: schema.TypeString,
32-
Optional: true,
33-
Default: "read",
34-
Description: "The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be 'read' or 'write'.",
35-
ValidateFunc: validation.StringInSlice([]string{"read", "write"}, false),
31+
Type: schema.TypeString,
32+
Optional: true,
33+
Default: "read",
34+
Description: "The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be 'read' or 'write'.",
35+
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"read", "write"}, false)),
3636
},
3737
"can_approve_pull_request_reviews": {
3838
Type: schema.TypeBool,

github/resource_github_repository_topics.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ func resourceGithubRepositoryTopics() *schema.Resource {
2626
},
2727
Schema: map[string]*schema.Schema{
2828
"repository": {
29-
Type: schema.TypeString,
30-
Required: true,
31-
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[-a-zA-Z0-9_.]{1,100}$`), "must include only alphanumeric characters, underscores or hyphens and consist of 100 characters or less"),
32-
Description: "The name of the repository. The name is not case sensitive.",
29+
Type: schema.TypeString,
30+
Required: true,
31+
ValidateDiagFunc: validation.ToDiagFunc(validation.StringMatch(regexp.MustCompile(`^[-a-zA-Z0-9_.]{1,100}$`), "must include only alphanumeric characters, underscores or hyphens and consist of 100 characters or less")),
32+
Description: "The name of the repository. The name is not case sensitive.",
3333
},
3434
"topics": {
3535
Type: schema.TypeSet,
3636
Required: true,
3737
Description: "An array of topics to add to the repository. Pass one or more topics to replace the set of existing topics. Send an empty array ([]) to clear all topics from the repository. Note: Topic names cannot contain uppercase letters.",
3838
Elem: &schema.Schema{
39-
Type: schema.TypeString,
40-
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z0-9][a-z0-9-]{0,49}$`), "must include only lowercase alphanumeric characters or hyphens and cannot start with a hyphen and consist of 50 characters or less"),
39+
Type: schema.TypeString,
40+
ValidateDiagFunc: validation.ToDiagFunc(validation.StringMatch(regexp.MustCompile(`^[a-z0-9][a-z0-9-]{0,49}$`), "must include only lowercase alphanumeric characters or hyphens and cannot start with a hyphen and consist of 50 characters or less")),
4141
},
4242
},
4343
},

0 commit comments

Comments
 (0)