Skip to content

Commit ceaa257

Browse files
author
Roberth Strand
authored
Merge pull request #5 from crayon/dev/rs
Added repositories, closes #4
2 parents a02e6cf + 1bc42dd commit ceaa257

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ override.tf.json
2121

2222
# Ignore any file with tfplan in it
2323
*tfplan*
24+
25+
*terraform.lock*

main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
github = {
44
source = "integrations/github"
5-
version = ">=4.13.0"
5+
version = "4.18.0"
66
}
77
}
88
}
@@ -16,14 +16,24 @@ resource "github_team" "team" {
1616

1717
resource "github_team_membership" "members" {
1818
for_each = toset(var.members)
19+
1920
team_id = github_team.team.id
2021
username = each.key
2122
role = "member"
2223
}
2324

2425
resource "github_team_membership" "maintainers" {
2526
for_each = toset(var.maintainers)
27+
2628
team_id = github_team.team.id
2729
username = each.key
2830
role = "maintainer"
2931
}
32+
33+
resource "github_team_repository" "repos" {
34+
for_each = { for r in var.repositories : r.name => r }
35+
36+
team_id = github_team.team.id
37+
repository = each.key
38+
permission = each.value.permission
39+
}

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
output "id" {
22
value = github_team.team.id
3-
description = "The "
3+
description = "The GitHub team Id."
44
}

variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ variable "maintainers" {
2727
description = "Maintainers of the team."
2828
default = []
2929
}
30+
variable "repositories" {
31+
type = list(object({
32+
name = string
33+
permission = string
34+
}))
35+
description = "A list of repositories associated with the team and the what access the members should have."
36+
default = []
37+
}

0 commit comments

Comments
 (0)