Skip to content

feat: add gh-membership module#976

Open
frmadem wants to merge 3 commits intomainfrom
feat/975-poc-gh-membership
Open

feat: add gh-membership module#976
frmadem wants to merge 3 commits intomainfrom
feat/975-poc-gh-membership

Conversation

@frmadem
Copy link
Contributor

@frmadem frmadem commented Mar 11, 2026

solves #975

@frmadem frmadem requested a review from a team as a code owner March 11, 2026 23:34
@frmadem frmadem linked an issue Mar 11, 2026 that may be closed by this pull request
Comment on lines +10 to +18
resource "github_team_membership" "relationships" {
for_each = {
for r in var.config.relationships : "${r.username}-${r.teamId}" => r
}

team_id = each.value.teamId # accepts slug directly
username = each.value.username
role = each.value.role
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Also included in gh-team module?
#953

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-membership) to manage GitHub organization membership and team membership relationships, and wires it into the repository’s release-please module release automation (Issue #975).

Changes:

  • Introduces modules/gh-membership implementing github_membership (org role) and github_team_membership (team relationships) driven by a single config object.
  • Adds module documentation scaffolding (terraform-docs config, header/footer docs) plus a basic example using JSON input.
  • Registers the new module in release-please-config.json.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
release-please-config.json Adds release-please package entry for the new gh-membership module.
modules/gh-membership/versions.tf Declares the GitHub provider requirement for the module.
modules/gh-membership/variables.tf Defines the strongly-typed config input object and validations.
modules/gh-membership/main.tf Creates org membership and team memberships from config.
modules/gh-membership/outputs.tf Exposes organization membership and team relationship outputs.
modules/gh-membership/.terraform-docs.yml Configures terraform-docs generation for the module README.
modules/gh-membership/docs/header.md Provides README header content and usage examples.
modules/gh-membership/docs/footer.md Provides README footer content (examples/resources/support).
modules/gh-membership/README.md Generated module README (terraform-docs injection).
modules/gh-membership/_examples/basic/main.tf Minimal example consuming config from JSON.
modules/gh-membership/_examples/basic/config.json Example JSON input for the module.

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

Comment on lines +2 to +4
### 3. `docs/footer.md`
```markdown
## Examples
Comment on lines +22 to +33
```hcl
module "membership" {
source = "git::https://github.com/prefapp/tfm.git//modules/gh-membership"

config = var.config
}

#### Inline example
```hcl
module "membership" {
source = "git::https://github.com/prefapp/tfm.git//modules/gh-membership"

Comment on lines +5 to +7
username = string
teamId = string # team slug (e.g. "jvazquez-prefapp-all")
role = optional(string, "member") # member | maintainer
for r in var.config.relationships : "${r.username}-${r.teamId}" => r
}

team_id = each.value.teamId # accepts slug directly
@@ -151,5 +151,8 @@
"modules/aws-secretsmanager-replication": {
"package-name": "aws-secretsmanager-replication"
}
@@ -151,5 +151,8 @@
"modules/aws-secretsmanager-replication": {
"package-name": "aws-secretsmanager-replication"
}
Comment on lines +21 to +30
```hcl
module "membership" {
source = "git::https://github.com/prefapp/tfm.git//modules/gh-membership"

config = var.config
}

#### Inline example
```hcl
module "membership" {
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 membership

3 participants