-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathrepositories.tf
42 lines (36 loc) · 1.22 KB
/
repositories.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
# Create infrastructure repository
resource "github_repository" "infrastructure" {
name = "learn-tf-infrastructure"
}
# Add memberships for infrastructure repository
resource "github_team_repository" "infrastructure" {
for_each = {
for team in local.repo_teams_files["infrastructure"] :
team.team_name => {
team_id = github_team.all[team.team_name].id
permission = team.permission
} if lookup(github_team.all, team.team_name, false) != false
}
team_id = each.value.team_id
repository = github_repository.infrastructure.id
permission = each.value.permission
}
# Create application repository
resource "github_repository" "application" {
name = "learn-tf-application"
}
# Add memberships for application repository
resource "github_team_repository" "application" {
for_each = {
for team in local.repo_teams_files["application"] :
team.team_name => {
team_id = github_team.all[team.team_name].id
permission = team.permission
} if lookup(github_team.all, team.team_name, false) != false
}
team_id = each.value.team_id
repository = github_repository.application.id
permission = each.value.permission
}