integrations / integrations/terraform-provider-github

Add support for creating teams with explicit maintainers

Open
#3,135 1 comment 6 reactions 0 assignees View on GitHub
Type: Feature
Dominant language
Go
Stars
1.2k
Forks
1k
Avg merge
1d 14h
Merged PRs (30d)
8

Description

_Originally posted by @mymasse in https://github.com/integrations/terraform-provider-github/discussions/3115_

Add deterministic support for `create_with_maintainers = []` to `github_team` so teams can be created and managed by non-privileged users.

The `create_default_maintainer` deprecation breaks creation of teams when Terraform is run by a non-privileged user. When running terraform with `maintainer_username` user, a regular user with a PAT with the required permissions (non org-admin). The following will fail:

```hcl
resource "github_team" "test" {
name = "Test"
parent_team_id = github_team.parent.id
privacy = "closed"
}

resource "github_team_members" "test" {
team_id = github_team.test.id

members {
username = "maintainer_username"
role = "maintainer"
}
members {
username = "mymasse"
}
}
```

```shell
github_team.test: Creating...
github_team.test: Creation complete after 3s [id=15957916]
github_team_members.test: Creating...

│ Error: PUT https://api.github.com/organizations/17620943/team/15957916/memberships/trecnoc-terraform: 403 You must be an organization owner or team maintainer to add a team membership. []

│ with github_team_members.test,
│ on main.tf line 359, in resource "github_team_members" "test":
│ 359: resource "github_team_members" "test" {


```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.