Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/github_team: Add maintainers #104

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 9 additions & 0 deletions github/resource_github_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func resourceGithubTeam() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"maintainers": {
Type: schema.TypeList,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
},
},
}
}
Expand All @@ -50,11 +55,13 @@ func resourceGithubTeamCreate(d *schema.ResourceData, meta interface{}) error {
n := d.Get("name").(string)
desc := d.Get("description").(string)
p := d.Get("privacy").(string)
m := expandStringList(d.Get("maintainers").([]interface{}))

newTeam := &github.NewTeam{
Name: n,
Description: &desc,
Privacy: &p,
Maintainers: m,
}
if parentTeamID, ok := d.GetOk("parent_team_id"); ok {
id := int64(parentTeamID.(int))
Expand Down Expand Up @@ -112,11 +119,13 @@ func resourceGithubTeamUpdate(d *schema.ResourceData, meta interface{}) error {
name := d.Get("name").(string)
description := d.Get("description").(string)
privacy := d.Get("privacy").(string)
maintainers := expandStringList(d.Get("maintainers").([]interface{}))

editedTeam := &github.NewTeam{
Name: name,
Description: &description,
Privacy: &privacy,
Maintainers: maintainers,
}
if parentTeamID, ok := d.GetOk("parent_team_id"); ok {
id := int64(parentTeamID.(int))
Expand Down
1 change: 1 addition & 0 deletions github/resource_github_team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ resource "github_team" "foo" {
name = "tf-acc-test-%s"
description = "Terraform acc test group"
privacy = "secret"
maintainers = ["bar"]
}
`, randString)
}
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/team.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ The following arguments are supported:
Defaults to `secret`.
* `parent_team_id` - (Optional) The ID of the parent team, if this is a nested team.
* `ldap_dn` - (Optional) The LDAP Distinguished Name of the group where membership will be synchronized. Only available in GitHub Enterprise.
* `maintainers` - (Optional) The logins of organization members to add as maintainers of the team.
Defaults to `[]` (an empty list)

## Attributes Reference

Expand Down