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
8 changes: 4 additions & 4 deletions github/data_source_github_collaborators.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ func dataSourceGithubCollaborators() *schema.Resource {
},
"affiliation": {
Type: schema.TypeString,
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{
"all",
"direct",
"outside",
}, false), "affiliation"),
}, false)),
Optional: true,
Default: "all",
},
"permission": {
Type: schema.TypeString,
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{
"pull",
"triage",
"push",
"maintain",
"admin",
}, false), "permission"),
}, false)),
Optional: true,
Default: "",
},
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_organization_teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func dataSourceGithubOrganizationTeams() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
Default: 100,
ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 100), "results_per_page"),
ValidateDiagFunc: validation.ToDiagFunc(validation.IntBetween(0, 100)),
},
"teams": {
Type: schema.TypeList,
Expand Down
4 changes: 2 additions & 2 deletions github/data_source_github_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ func dataSourceGithubRelease() *schema.Resource {
Type: schema.TypeString,
Required: true,
Description: "Describes how to fetch the release. Valid values are `id`, `tag`, `latest`.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{
"latest",
"id",
"tag",
}, false), "retrieve_by"),
}, false)),
},
"release_tag": {
Type: schema.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions github/data_source_github_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func dataSourceGithubRepositories() *schema.Resource {
Type: schema.TypeString,
Default: "updated",
Optional: true,
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"stars", "fork", "updated"}, false), "sort"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"stars", "fork", "updated"}, false)),
},
"include_repo_id": {
Type: schema.TypeBool,
Expand All @@ -32,7 +32,7 @@ func dataSourceGithubRepositories() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
Default: 100,
ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 1000), "results_per_page"),
ValidateDiagFunc: validation.ToDiagFunc(validation.IntBetween(0, 1000)),
},
"full_names": {
Type: schema.TypeList,
Expand Down
6 changes: 3 additions & 3 deletions github/data_source_github_repository_pull_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ func dataSourceGithubRepositoryPullRequests() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Default: "created",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"created", "updated", "popularity", "long-running"}, false), "sort_by"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"created", "updated", "popularity", "long-running"}, false)),
},
"sort_direction": {
Type: schema.TypeString,
Optional: true,
Default: "asc",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"asc", "desc"}, false), "sort_direction"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"asc", "desc"}, false)),
},
"state": {
Type: schema.TypeString,
Default: "open",
Optional: true,
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"open", "closed", "all"}, false), "state"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"open", "closed", "all"}, false)),
},
"results": {
Type: schema.TypeList,
Expand Down
4 changes: 2 additions & 2 deletions github/data_source_github_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func dataSourceGithubTeam() *schema.Resource {
Type: schema.TypeString,
Default: "all",
Optional: true,
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "immediate"}, false), "membership_type"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"all", "immediate"}, false)),
},
"summary_only": {
Type: schema.TypeBool,
Expand All @@ -93,7 +93,7 @@ func dataSourceGithubTeam() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
Default: 100,
ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 100), "results_per_page"),
ValidateDiagFunc: validation.ToDiagFunc(validation.IntBetween(0, 100)),
Deprecated: "This is deprecated and will be removed in a future release.",
},
},
Expand Down
1 change: 1 addition & 0 deletions github/data_source_github_team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ func TestAccGithubTeamDataSource(t *testing.T) {

resource "github_team" "test" {
name = "%s"
description = "test"
}

resource "github_team_repository" "test" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func resourceGithubActionsEnvironmentSecretV0() *schema.Resource {
ForceNew: true,
Description: "Encrypted value of the secret using the GitHub public key in Base64 format.",
ConflictsWith: []string{"plaintext_value"},
ValidateDiagFunc: toDiagFunc(validation.StringIsBase64, "encrypted_value"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsBase64),
},
"plaintext_value": {
Type: schema.TypeString,
Expand Down
24 changes: 12 additions & 12 deletions github/resource_github_actions_hosted_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ func resourceGithubActionsHostedRunner() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.All(
ValidateDiagFunc: validation.ToDiagFunc(validation.All(
validation.StringLenBetween(1, 64),
validation.StringMatch(
regexp.MustCompile(`^[a-zA-Z0-9._-]+$`),
"name may only contain alphanumeric characters, '.', '-', and '_'",
),
),
)),
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 '_'.",
},
"image": {
Expand All @@ -56,11 +56,11 @@ func resourceGithubActionsHostedRunner() *schema.Resource {
Description: "The image ID.",
},
"source": {
Type: schema.TypeString,
Optional: true,
Default: "github",
ValidateFunc: validation.StringInSlice([]string{"github", "partner", "custom"}, false),
Description: "The image source (github, partner, or custom).",
Type: schema.TypeString,
Optional: true,
Default: "github",
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"github", "partner", "custom"}, false)),
Description: "The image source (github, partner, or custom).",
},
"size_gb": {
Type: schema.TypeInt,
Expand All @@ -82,11 +82,11 @@ func resourceGithubActionsHostedRunner() *schema.Resource {
Description: "The runner group ID.",
},
"maximum_runners": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: validation.IntAtLeast(1),
Description: "Maximum number of runners to scale up to.",
Type: schema.TypeInt,
Optional: true,
Computed: true,
ValidateDiagFunc: validation.ToDiagFunc(validation.IntAtLeast(1)),
Description: "Maximum number of runners to scale up to.",
},
"public_ip_enabled": {
Type: schema.TypeBool,
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_actions_organization_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ func resourceGithubActionsOrganizationPermissions() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Description: "The permissions policy that controls the actions that are allowed to run. Can be one of: 'all', 'local_only', or 'selected'.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "local_only", "selected"}, false), "allowed_actions"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"all", "local_only", "selected"}, false)),
},
"enabled_repositories": {
Type: schema.TypeString,
Required: true,
Description: "The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: 'all', 'none', or 'selected'.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "none", "selected"}, false), "enabled_repositories"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"all", "none", "selected"}, false)),
},
"allowed_actions_config": {
Type: schema.TypeList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func resourceGithubActionsOrganizationSecretV0() *schema.Resource {
Sensitive: true,
ConflictsWith: []string{"plaintext_value"},
Description: "Encrypted value of the secret using the GitHub public key in Base64 format.",
ValidateDiagFunc: toDiagFunc(validation.StringIsBase64, "encrypted_value"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsBase64),
},
"plaintext_value": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func resourceGithubActionsOrganizationWorkflowPermissions() *schema.Resource {
Description: "The slug of the Organization.",
},
"default_workflow_permissions": {
Type: schema.TypeString,
Optional: true,
Default: "read",
Description: "The default workflow permissions granted to the GITHUB_TOKEN when running workflows in any repository in the organization. Can be 'read' or 'write'.",
ValidateFunc: validation.StringInSlice([]string{"read", "write"}, false),
Type: schema.TypeString,
Optional: true,
Default: "read",
Description: "The default workflow permissions granted to the GITHUB_TOKEN when running workflows in any repository in the organization. Can be 'read' or 'write'.",
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"read", "write"}, false)),
},
"can_approve_pull_request_reviews": {
Type: schema.TypeBool,
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_actions_repository_access_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func resourceGithubActionsRepositoryAccessLevel() *schema.Resource {
Type: schema.TypeString,
Required: true,
Description: "Where the actions or reusable workflows of the repository may be used. Possible values are 'none', 'user', 'organization', or 'enterprise'.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"none", "user", "organization", "enterprise"}, false), "access_level"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"none", "user", "organization", "enterprise"}, false)),
},
"repository": {
Type: schema.TypeString,
Required: true,
Description: "The GitHub repository.",
ValidateDiagFunc: toDiagFunc(validation.StringLenBetween(1, 100), "repository"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 100)),
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplate() *sch
Type: schema.TypeString,
Required: true,
Description: "The name of the repository.",
ValidateDiagFunc: toDiagFunc(validation.StringLenBetween(1, 100), "repository"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 100)),
},
"use_default": {
Type: schema.TypeBool,
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_actions_repository_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func resourceGithubActionsRepositoryPermissions() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Description: "The permissions policy that controls the actions that are allowed to run. Can be one of: 'all', 'local_only', or 'selected'.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "local_only", "selected"}, false), "allowed_actions"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"all", "local_only", "selected"}, false)),
},
"allowed_actions_config": {
Type: schema.TypeList,
Expand Down Expand Up @@ -63,7 +63,7 @@ func resourceGithubActionsRepositoryPermissions() *schema.Resource {
Type: schema.TypeString,
Required: true,
Description: "The GitHub repository.",
ValidateDiagFunc: toDiagFunc(validation.StringLenBetween(1, 100), "repository"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 100)),
},
"sha_pinning_required": {
Type: schema.TypeBool,
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_actions_runner_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func resourceGithubActionsRunnerGroup() *schema.Resource {
Type: schema.TypeString,
Required: true,
Description: "The visibility of the runner group.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "selected", "private"}, false), "visibility"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"all", "selected", "private"}, false)),
},
"restricted_to_workflows": {
Type: schema.TypeBool,
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func resourceGithubBranchProtection() *schema.Resource {
Optional: true,
Default: 1,
Description: "Require 'x' number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6.",
ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 6), PROTECTION_REQUIRED_APPROVING_REVIEW_COUNT),
ValidateDiagFunc: validation.ToDiagFunc(validation.IntBetween(0, 6)),
},
PROTECTION_REQUIRES_CODE_OWNER_REVIEWS: {
Type: schema.TypeBool,
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_branch_protection_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func resourceGithubBranchProtectionV3() *schema.Resource {
Optional: true,
Default: 1,
Description: "Require 'x' number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6.",
ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 6), "required_approving_review_count"),
ValidateDiagFunc: validation.ToDiagFunc(validation.IntBetween(0, 6)),
},
"require_last_push_approval": {
Type: schema.TypeBool,
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_codespaces_organization_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func resourceGithubCodespacesOrganizationSecret() *schema.Resource {
Sensitive: true,
ConflictsWith: []string{"plaintext_value"},
Description: "Encrypted value of the secret using the GitHub public key in Base64 format.",
ValidateDiagFunc: toDiagFunc(validation.StringIsBase64, "encrypted_value"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsBase64),
},
"plaintext_value": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_codespaces_user_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func resourceGithubCodespacesUserSecret() *schema.Resource {
Sensitive: true,
ConflictsWith: []string{"plaintext_value"},
Description: "Encrypted value of the secret using the GitHub public key in Base64 format.",
ValidateDiagFunc: toDiagFunc(validation.StringIsBase64, "encrypted_value"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsBase64),
},
"plaintext_value": {
Type: schema.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions github/resource_github_enterprise_actions_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ func resourceGithubActionsEnterprisePermissions() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Description: "The permissions policy that controls the actions that are allowed to run. Can be one of: 'all', 'local_only', or 'selected'.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "local_only", "selected"}, false), "allowed_actions"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"all", "local_only", "selected"}, false)),
},
"enabled_organizations": {
Type: schema.TypeString,
Required: true,
Description: "The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: 'all', 'none', or 'selected'.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "none", "selected"}, false), "enabled_organizations"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"all", "none", "selected"}, false)),
},
"allowed_actions_config": {
Type: schema.TypeList,
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_enterprise_actions_runner_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func resourceGithubActionsEnterpriseRunnerGroup() *schema.Resource {
Type: schema.TypeString,
Required: true,
Description: "The visibility of the runner group.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "selected"}, false), "visibility"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"all", "selected"}, false)),
},
"restricted_to_workflows": {
Type: schema.TypeBool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func resourceGithubEnterpriseActionsWorkflowPermissions() *schema.Resource {
Description: "The slug of the enterprise.",
},
"default_workflow_permissions": {
Type: schema.TypeString,
Optional: true,
Default: "read",
Description: "The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be 'read' or 'write'.",
ValidateFunc: validation.StringInSlice([]string{"read", "write"}, false),
Type: schema.TypeString,
Optional: true,
Default: "read",
Description: "The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be 'read' or 'write'.",
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"read", "write"}, false)),
},
"can_approve_pull_request_reviews": {
Type: schema.TypeBool,
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_organization_ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func resourceGithubOrganizationRuleset() *schema.Resource {
"type": {
Type: schema.TypeString,
Required: true,
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"Team"}, false), "type"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"Team"}, false)),
Description: "The type of reviewer. Currently only `Team` is supported.",
},
},
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_organization_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func resourceGithubOrganizationSettings() *schema.Resource {
Optional: true,
Default: "read",
Description: "The default permission for organization members to create new repositories. Can be one of 'read', 'write', 'admin' or 'none'.",
ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"read", "write", "admin", "none"}, false), "default_repository_permission"),
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"read", "write", "admin", "none"}, false)),
},
"members_can_create_repositories": {
Type: schema.TypeBool,
Expand Down
Loading