Skip to content

Commit 38967cf

Browse files
morisilclaude
andcommitted
add optional dev team repository association
Add dev_team_id variable to automatically create github_team_repository resource with push permission, reducing boilerplate when using the module. Also add development guidelines to CLAUDE.md requiring consultation of official GitHub provider docs before making changes. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 8b1f196 commit 38967cf

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ module "my_repo" {
3434
}
3535
```
3636

37+
## Development Guidelines
38+
39+
Before making any changes to this module, consult the official GitHub Terraform provider documentation at https://registry.terraform.io/providers/integrations/github/latest/docs to ensure compatibility with the latest provider version and best practices.
40+
3741
## Key Configuration Notes
3842

3943
- `branch_protection` defaults to `true` but must be `false` for private repos on free GitHub plans (rulesets have the same plan restrictions as the legacy branch protection)

repository/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ resource "github_repository" "this" {
4545
}
4646
}
4747

48+
resource "github_team_repository" "developers" {
49+
count = var.dev_team_id != null ? 1 : 0
50+
team_id = var.dev_team_id
51+
repository = github_repository.this.name
52+
permission = "push"
53+
}
54+
4855
resource "github_repository_ruleset" "main" {
4956
count = var.branch_protection ? 1 : 0
5057
name = "main-branch-protection"

repository/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,9 @@ variable "required_status_check" {
7878
type = string
7979
default = "build_branch"
8080
}
81+
82+
variable "dev_team_id" {
83+
description = "The ID of the developers team to grant push access. Set to `null` to skip team association."
84+
type = string
85+
default = null
86+
}

0 commit comments

Comments
 (0)