Skip to content

Commit

Permalink
Change name of branch_pattern argument to pattern for github_reposito…
Browse files Browse the repository at this point in the history
…ry_environment_deployment_policy resource
  • Loading branch information
mcevoypeter committed Dec 6, 2023
1 parent af308a1 commit 029960b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func resourceGithubRepositoryEnvironmentDeploymentPolicy() *schema.Resource {
ForceNew: true,
Description: "The name of the environment.",
},
"branch_pattern": {
"pattern": {
Type: schema.TypeString,
Required: true,
ForceNew: false,
Expand All @@ -51,11 +51,11 @@ func resourceGithubRepositoryEnvironmentDeploymentPolicyCreate(d *schema.Resourc
owner := meta.(*Owner).name
repoName := d.Get("repository").(string)
envName := d.Get("environment").(string)
branchPattern := d.Get("branch_pattern").(string)
pattern := d.Get("pattern").(string)
escapedEnvName := url.PathEscape(envName)

createData := github.DeploymentBranchPolicyRequest{
Name: github.String(branchPattern),
Name: github.String(pattern),
Type: github.String("branch"),
}

Expand Down Expand Up @@ -99,7 +99,7 @@ func resourceGithubRepositoryEnvironmentDeploymentPolicyRead(d *schema.ResourceD
return err
}

d.Set("branch_pattern", branchPolicy.GetName())
d.Set("pattern", branchPolicy.GetName())
return nil
}

Expand All @@ -110,7 +110,7 @@ func resourceGithubRepositoryEnvironmentDeploymentPolicyUpdate(d *schema.Resourc
owner := meta.(*Owner).name
repoName := d.Get("repository").(string)
envName := d.Get("environment").(string)
branchPattern := d.Get("branch_pattern").(string)
pattern := d.Get("pattern").(string)
escapedEnvName := url.PathEscape(envName)
_, _, branchPolicyIdString, err := parseThreePartID(d.Id(), "repository", "environment", "branchPolicyId")
if err != nil {
Expand All @@ -123,7 +123,7 @@ func resourceGithubRepositoryEnvironmentDeploymentPolicyUpdate(d *schema.Resourc
}

updateData := github.DeploymentBranchPolicyRequest{
Name: github.String(branchPattern),
Name: github.String(pattern),
Type: nil,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) {
}
resource "github_repository_environment_deployment_policy" "test" {
repository = github_repository.test.name
environment = github_repository_environment.test.environment
branch_pattern = "releases/*"
repository = github_repository.test.name
environment = github_repository_environment.test.environment
pattern = "releases/*"
}
`, randomID)
Expand All @@ -55,7 +55,7 @@ func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) {
"environment/test",
),
resource.TestCheckResourceAttr(
"github_repository_environment_deployment_policy.test", "branch_pattern",
"github_repository_environment_deployment_policy.test", "pattern",
"releases/*",
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "github_repository_environment" "test" {
resource "github_repository_environment_deployment_policy" "test" {
repository = github_repository.test.name
environment = github_repository_environment.test.environment
branch_pattern = "releases/*"
pattern = "releases/*"
}
```

Expand All @@ -48,7 +48,7 @@ The following arguments are supported:

* `repository` - (Required) The repository of the environment.

* `branch_pattern` - (Required) The name pattern that branches must match in order to deploy to the environment.
* `pattern` - (Required) The name pattern that branches must match in order to deploy to the environment.


## Import
Expand Down

0 comments on commit 029960b

Please sign in to comment.