Skip to content

Commit d7d1b19

Browse files
committed
fix destroy if main does not exist
1 parent 15b466b commit d7d1b19

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

github/resource_github_branch_default.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ func resourceGithubBranchDefault() *schema.Resource {
3131
ForceNew: true,
3232
Description: "The GitHub repository.",
3333
},
34+
"orgs_default_branch": {
35+
Type: schema.TypeString,
36+
Required: true,
37+
ForceNew: true,
38+
Description: "The organization default branch",
39+
},
3440
"rename": {
3541
Type: schema.TypeBool,
3642
Optional: true,
@@ -121,9 +127,10 @@ func resourceGithubBranchDefaultDelete(d *schema.ResourceData, meta interface{})
121127
client := meta.(*Owner).v3client
122128
owner := meta.(*Owner).name
123129
repoName := d.Id()
130+
orgsDefaultBranch := d.Get("orgs_default_branch").(string)
124131

125132
repository := &github.Repository{
126-
DefaultBranch: nil,
133+
DefaultBranch: &orgsDefaultBranch,
127134
}
128135

129136
ctx := context.Background()

0 commit comments

Comments
 (0)