Skip to content

feat: add poc of gh-team#953

Open
frmadem wants to merge 8 commits intomainfrom
feat/952-poc-gh-group
Open

feat: add poc of gh-team#953
frmadem wants to merge 8 commits intomainfrom
feat/952-poc-gh-group

Conversation

@frmadem
Copy link
Contributor

@frmadem frmadem commented Feb 27, 2026

solves #952

@frmadem frmadem requested a review from a team as a code owner February 27, 2026 15:25
@frmadem frmadem linked an issue Feb 27, 2026 that may be closed by this pull request
Comment on lines +10 to +18
resource "github_team_membership" "members" {
for_each = {
for m in var.config.group_members : m.username => m
}

team_id = github_team.this.id
username = each.value.username
role = "member"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The github_membership has also this feature to include an user in a set of teams. Which of the two do we use/need? 🤔

https://github.com/prefapp/tfm/pull/976/changes#diff-8a6946bf512db838084ac736bb4a34ef33f4926f070a0b5628d6e167c2e3a0d4R10-R18

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Terraform module (modules/gh-team) intended as a proof-of-concept for managing GitHub teams and team memberships, and wires it into the repo’s release-please configuration (per issue #952).

Changes:

  • Register modules/gh-team in release-please-config.json.
  • Add modules/gh-team Terraform module (resources, variables, outputs), docs, changelog, and a basic example.
  • Remove the repository root README.md.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
release-please-config.json Adds the new module to release-please package configuration.
modules/gh-team/versions.tf Declares GitHub provider requirement for the new module.
modules/gh-team/variables.tf Defines a single config object input with validations.
modules/gh-team/main.tf Creates the GitHub team and assigns memberships.
modules/gh-team/outputs.tf Exposes created team attributes and member list.
modules/gh-team/docs/header.md Module documentation header content used by terraform-docs.
modules/gh-team/docs/footer.md Module documentation footer content used by terraform-docs.
modules/gh-team/README.md Generated module README (terraform-docs injected).
modules/gh-team/_examples/basic/main.tf Minimal example for consuming the module.
modules/gh-team/_examples/basic/config.json Example JSON config for the module.
modules/gh-team/CHANGELOG.md Initial changelog entry for the module.
modules/gh-team/.terraform-docs.yml terraform-docs configuration for README generation.
README.md Deletes the repository root README.
Comments suppressed due to low confidence (1)

README.md:1

  • This PR deletes the repository root README.md. If this is unintentional, please restore it (it currently documents the repo’s release-please workflow). If it is intentional, consider replacing it with an updated root README rather than removing it entirely.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Overview

This module provisions a single GitHub Team and automatically manages its members using a single strongly-typed `config` object.
It supports nested teams (`parentTeamId`), privacy settings (`closed`/`secret`), and full membership roles while keeping the external interface minimal and JSON-friendly.
Comment on lines +153 to +155
},
"modules/gh-team": {
"package-name": "gh-team"
Comment on lines +1 to +8
terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 6.0"
}
}
}

team_id = github_team.this.id
username = each.value.username
role = "member"
Comment on lines +23 to +28
```hcl
module "my_team" {
source = "git::https://github.com/prefapp/tfm.git//modules/github-team"

config = jsondecode(file("${path.root}/team-config.json"))
}
Comment on lines +1 to +8
terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 6.0"
}
}
}

```hcl
module "my_team" {
source = "git::https://github.com/prefapp/tfm.git//modules/github-team"
Comment on lines +73 to +90
### 3. `docs/footer.md`
```markdown
## Examples

For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/github-team/_examples):

- [basic](https://github.com/prefapp/tfm/tree/main/modules/github-team/_examples/basic) - Minimal team creation with JSON input

## Resources

- **github_team**: [Official Documentation](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team)
- **github_team_membership**: [Official Documentation](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_membership)
- **GitHub Terraform Provider**: [Official Documentation](https://registry.terraform.io/providers/integrations/github/latest/docs)

## Support

For issues, questions, or contributions related to this module, please visit the [repository's issue tracker](https://github.com/prefapp/tfm/issues).
```
Comment on lines +2 to +10
### 3. `docs/footer.md`
```markdown
## Examples

For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/github-team/_examples):

- [basic](https://github.com/prefapp/tfm/tree/main/modules/github-team/_examples/basic) - Minimal team creation with JSON input

## Resources
module "example_team" {
source = "../../" # points to the module root

config = jsondecode(file("${path.module}/team-config.json"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

POC gh group

4 participants