Skip to content

Commit 3c1aee2

Browse files
authored
Update resources.tf
1 parent 1727575 commit 3c1aee2

File tree

1 file changed

+81
-81
lines changed

1 file changed

+81
-81
lines changed

terraform/resources.tf

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ resource "github_membership" "this" {
55
source = "config"
66
index = member
77
}
8-
] : item.index => item.source
8+
] : item.index => local.resources[item.source].github_membership.this[item.index]
99
}
1010

11-
username = local.resources[each.value].github_membership.this[each.key].username
12-
role = local.resources[each.value].github_membership.this[each.key].role
11+
username = each.value.username
12+
role = each.value.role
1313

1414
lifecycle {
1515
ignore_changes = []
@@ -28,41 +28,41 @@ resource "github_repository" "this" {
2828
source = "config"
2929
index = repository
3030
}
31-
] : item.index => item.source
31+
] : item.index => local.resources[item.source].github_repository.this[item.index]
3232
}
3333

34-
name = local.resources[each.value].github_repository.this[each.key].name
35-
allow_auto_merge = try(local.resources[each.value].github_repository.this[each.key].allow_auto_merge, null)
36-
allow_merge_commit = try(local.resources[each.value].github_repository.this[each.key].allow_merge_commit, null)
37-
allow_rebase_merge = try(local.resources[each.value].github_repository.this[each.key].allow_rebase_merge, null)
38-
allow_squash_merge = try(local.resources[each.value].github_repository.this[each.key].allow_squash_merge, null)
39-
allow_update_branch = try(local.resources[each.value].github_repository.this[each.key].allow_update_branch, null)
40-
archive_on_destroy = try(local.resources[each.value].github_repository.this[each.key].archive_on_destroy, null)
41-
archived = try(local.resources[each.value].github_repository.this[each.key].archived, null)
42-
auto_init = try(local.resources[each.value].github_repository.this[each.key].auto_init, null)
43-
default_branch = try(local.resources[each.value].github_repository.this[each.key].default_branch, null)
44-
delete_branch_on_merge = try(local.resources[each.value].github_repository.this[each.key].delete_branch_on_merge, null)
45-
description = try(local.resources[each.value].github_repository.this[each.key].description, null)
46-
gitignore_template = try(local.resources[each.value].github_repository.this[each.key].gitignore_template, null)
47-
has_discussions = try(local.resources[each.value].github_repository.this[each.key].has_discussions, null)
48-
has_downloads = try(local.resources[each.value].github_repository.this[each.key].has_downloads, null)
49-
has_issues = try(local.resources[each.value].github_repository.this[each.key].has_issues, null)
50-
has_projects = try(local.resources[each.value].github_repository.this[each.key].has_projects, null)
51-
has_wiki = try(local.resources[each.value].github_repository.this[each.key].has_wiki, null)
52-
homepage_url = try(local.resources[each.value].github_repository.this[each.key].homepage_url, null)
53-
ignore_vulnerability_alerts_during_read = try(local.resources[each.value].github_repository.this[each.key].ignore_vulnerability_alerts_during_read, null)
54-
is_template = try(local.resources[each.value].github_repository.this[each.key].is_template, null)
55-
license_template = try(local.resources[each.value].github_repository.this[each.key].license_template, null)
56-
merge_commit_message = try(local.resources[each.value].github_repository.this[each.key].merge_commit_message, null)
57-
merge_commit_title = try(local.resources[each.value].github_repository.this[each.key].merge_commit_title, null)
58-
squash_merge_commit_message = try(local.resources[each.value].github_repository.this[each.key].squash_merge_commit_message, null)
59-
squash_merge_commit_title = try(local.resources[each.value].github_repository.this[each.key].squash_merge_commit_title, null)
60-
topics = try(local.resources[each.value].github_repository.this[each.key].topics, null)
61-
visibility = try(local.resources[each.value].github_repository.this[each.key].visibility, null)
62-
vulnerability_alerts = try(local.resources[each.value].github_repository.this[each.key].vulnerability_alerts, null)
34+
name = each.value.name
35+
allow_auto_merge = try(each.value.allow_auto_merge, null)
36+
allow_merge_commit = try(each.value.allow_merge_commit, null)
37+
allow_rebase_merge = try(each.value.allow_rebase_merge, null)
38+
allow_squash_merge = try(each.value.allow_squash_merge, null)
39+
allow_update_branch = try(each.value.allow_update_branch, null)
40+
archive_on_destroy = try(each.value.archive_on_destroy, null)
41+
archived = try(each.value.archived, null)
42+
auto_init = try(each.value.auto_init, null)
43+
default_branch = try(each.value.default_branch, null)
44+
delete_branch_on_merge = try(each.value.delete_branch_on_merge, null)
45+
description = try(each.value.description, null)
46+
gitignore_template = try(each.value.gitignore_template, null)
47+
has_discussions = try(each.value.has_discussions, null)
48+
has_downloads = try(each.value.has_downloads, null)
49+
has_issues = try(each.value.has_issues, null)
50+
has_projects = try(each.value.has_projects, null)
51+
has_wiki = try(each.value.has_wiki, null)
52+
homepage_url = try(each.value.homepage_url, null)
53+
ignore_vulnerability_alerts_during_read = try(each.value.ignore_vulnerability_alerts_during_read, null)
54+
is_template = try(each.value.is_template, null)
55+
license_template = try(each.value.license_template, null)
56+
merge_commit_message = try(each.value.merge_commit_message, null)
57+
merge_commit_title = try(each.value.merge_commit_title, null)
58+
squash_merge_commit_message = try(each.value.squash_merge_commit_message, null)
59+
squash_merge_commit_title = try(each.value.squash_merge_commit_title, null)
60+
topics = try(each.value.topics, null)
61+
visibility = try(each.value.visibility, null)
62+
vulnerability_alerts = try(each.value.vulnerability_alerts, null)
6363

6464
dynamic "security_and_analysis" {
65-
for_each = try(local.resources[each.value].github_repository.this[each.key].security_and_analysis, [])
65+
for_each = try(each.value.security_and_analysis, [])
6666

6767
content {
6868
dynamic "advanced_security" {
@@ -87,7 +87,7 @@ resource "github_repository" "this" {
8787
}
8888

8989
dynamic "pages" {
90-
for_each = try(local.resources[each.value].github_repository.this[each.key].pages, [])
90+
for_each = try(each.value.pages, [])
9191
content {
9292
cname = try(pages.value["cname"], null)
9393
dynamic "source" {
@@ -100,7 +100,7 @@ resource "github_repository" "this" {
100100
}
101101
}
102102
dynamic "template" {
103-
for_each = try(local.resources[each.value].github_repository.this[each.key].template, [])
103+
for_each = try(each.value.template, [])
104104
content {
105105
owner = template.value["owner"]
106106
repository = template.value["repository"]
@@ -129,14 +129,14 @@ resource "github_repository_collaborator" "this" {
129129
} if try(regex("^${repository}:", member), null) != null
130130
]
131131
])
132-
]) : item.index => item.source
132+
]) : item.index => local.resources[item.source].github_repository_collaborator.this[item.index]
133133
}
134134

135135
depends_on = [github_repository.this]
136136

137-
repository = local.resources[each.value].github_repository_collaborator.this[each.key].repository
138-
username = local.resources[each.value].github_repository_collaborator.this[each.key].username
139-
permission = local.resources[each.value].github_repository_collaborator.this[each.key].permission
137+
repository = each.value.repository
138+
username = each.value.username
139+
permission = each.value.permission
140140

141141
lifecycle {
142142
ignore_changes = []
@@ -159,27 +159,27 @@ resource "github_branch_protection" "this" {
159159
} if try(regex("^${repository}:", branch_protection), null) != null
160160
]
161161
])
162-
]) : item.index => item.source
162+
]) : item.index => local.resources[item.source].github_branch_protection.this[item.index]
163163
}
164164

165165
depends_on = [github_repository.this]
166166

167-
pattern = local.resources[each.value].github_branch_protection.this[each.key].pattern
167+
pattern = each.value.pattern
168168

169-
repository_id = try(local.resources[each.value].github_branch_protection.this[each.key].repository_id, github_repository.this[lower(local.resources[each.value].github_branch_protection.this[each.key].repository)].node_id)
169+
repository_id = try(each.value.repository)].node_id)
170170

171-
allows_deletions = try(local.resources[each.value].github_branch_protection.this[each.key].allows_deletions, null)
172-
allows_force_pushes = try(local.resources[each.value].github_branch_protection.this[each.key].allows_force_pushes, null)
173-
blocks_creations = try(local.resources[each.value].github_branch_protection.this[each.key].blocks_creations, null)
174-
enforce_admins = try(local.resources[each.value].github_branch_protection.this[each.key].enforce_admins, null)
175-
lock_branch = try(local.resources[each.value].github_branch_protection.this[each.key].lock_branch, null)
176-
push_restrictions = try(local.resources[each.value].github_branch_protection.this[each.key].push_restrictions, null)
177-
require_conversation_resolution = try(local.resources[each.value].github_branch_protection.this[each.key].require_conversation_resolution, null)
178-
require_signed_commits = try(local.resources[each.value].github_branch_protection.this[each.key].require_signed_commits, null)
179-
required_linear_history = try(local.resources[each.value].github_branch_protection.this[each.key].required_linear_history, null)
171+
allows_deletions = try(each.value.allows_deletions, null)
172+
allows_force_pushes = try(each.value.allows_force_pushes, null)
173+
blocks_creations = try(each.value.blocks_creations, null)
174+
enforce_admins = try(each.value.enforce_admins, null)
175+
lock_branch = try(each.value.lock_branch, null)
176+
push_restrictions = try(each.value.push_restrictions, null)
177+
require_conversation_resolution = try(each.value.require_conversation_resolution, null)
178+
require_signed_commits = try(each.value.require_signed_commits, null)
179+
required_linear_history = try(each.value.required_linear_history, null)
180180

181181
dynamic "required_pull_request_reviews" {
182-
for_each = try(local.resources[each.value].github_branch_protection.this[each.key].required_pull_request_reviews, [])
182+
for_each = try(each.value.required_pull_request_reviews, [])
183183
content {
184184
dismiss_stale_reviews = try(required_pull_request_reviews.value["dismiss_stale_reviews"], null)
185185
dismissal_restrictions = try(required_pull_request_reviews.value["dismissal_restrictions"], null)
@@ -190,7 +190,7 @@ resource "github_branch_protection" "this" {
190190
}
191191
}
192192
dynamic "required_status_checks" {
193-
for_each = try(local.resources[each.value].github_branch_protection.this[each.key].required_status_checks, null)
193+
for_each = try(each.value.required_status_checks, null)
194194
content {
195195
contexts = try(required_status_checks.value["contexts"], null)
196196
strict = try(required_status_checks.value["strict"], null)
@@ -205,15 +205,15 @@ resource "github_team" "this" {
205205
source = "config"
206206
index = team
207207
}
208-
] : item.index => item.source
208+
] : item.index => local.resources[item.source].github_team.this[item.index]
209209
}
210210

211-
name = local.resources[each.value].github_team.this[each.key].name
211+
name = each.value.name
212212

213-
parent_team_id = try(try(element(data.github_organization_teams.this[0].teams, index(data.github_organization_teams.this[0].teams.*.name, local.resources[each.value].github_team.this[each.key].parent_team_id)).id, local.resources[each.value].github_team.this[each.key].parent_team_id), null)
213+
parent_team_id = try(try(element(data.github_organization_teams.this[0].teams, index(data.github_organization_teams.this[0].teams.*.name, each.value.parent_team_id)).id, each.value.parent_team_id), null)
214214

215-
description = try(local.resources[each.value].github_team.this[each.key].description, null)
216-
privacy = try(local.resources[each.value].github_team.this[each.key].privacy, null)
215+
description = try(each.value.description, null)
216+
privacy = try(each.value.privacy, null)
217217

218218
lifecycle {
219219
ignore_changes = []
@@ -236,15 +236,15 @@ resource "github_team_repository" "this" {
236236
} if try(regex(":${repository}$", team), null) != null
237237
]
238238
])
239-
]) : item.index => item.source
239+
]) : item.index => local.resources[item.source].github_team_repository.this[item.index]
240240
}
241241

242242
depends_on = [github_team.this, github_repository.this]
243243

244-
repository = local.resources[each.value].github_team_repository.this[each.key].repository
245-
permission = local.resources[each.value].github_team_repository.this[each.key].permission
244+
repository = each.value.repository
245+
permission = each.value.permission
246246

247-
team_id = try(local.resources[each.value].github_team_repository.this[each.key].team_id, github_team.this[lower(local.resources[each.value].github_team_repository.this[each.key].team)].id)
247+
team_id = try(each.value.team)].id)
248248

249249
lifecycle {
250250
ignore_changes = []
@@ -258,15 +258,15 @@ resource "github_team_membership" "this" {
258258
source = "config"
259259
index = member
260260
}
261-
] : item.index => item.source
261+
] : item.index => local.resources[item.source].github_team_membership.this[item.index]
262262
}
263263

264264
depends_on = [github_team.this]
265265

266-
username = local.resources[each.value].github_team_membership.this[each.key].username
267-
role = local.resources[each.value].github_team_membership.this[each.key].role
266+
username = each.value.username
267+
role = each.value.role
268268

269-
team_id = try(local.resources[each.value].github_team_membership.this[each.key].team_id, github_team.this[lower(local.resources[each.value].github_team_membership.this[each.key].team)].id)
269+
team_id = try(each.value.team)].id)
270270

271271
lifecycle {
272272
ignore_changes = []
@@ -289,22 +289,22 @@ resource "github_repository_file" "this" {
289289
} if try(regex("^${repository}/", file), null) != null
290290
]
291291
])
292-
]) : item.index => item.source
292+
]) : item.index => local.resources[item.source].github_repository_file.this[item.index]
293293
}
294294

295295
depends_on = [github_repository.this]
296296

297-
repository = local.resources[each.value].github_repository_file.this[each.key].repository
298-
file = local.resources[each.value].github_repository_file.this[each.key].file
299-
content = local.resources[each.value].github_repository_file.this[each.key].content
297+
repository = each.value.repository
298+
file = each.value.file
299+
content = each.value.content
300300
# Since 5.25.0 the branch attribute defaults to the default branch of the repository
301301
# branch = try(each.value.branch, null)
302-
branch = try(local.resources[each.value].github_repository_file.this[each.key].repository, github_repository.this[lower(local.resources[each.value].github_repository_file.this[each.key].repository)].default_branch)
303-
overwrite_on_create = try(local.resources[each.value].github_repository_file.this[each.key].overwrite_on_create, true)
302+
branch = try(each.value.branch, github_repository.this[each.value.repository].default_branch)
303+
overwrite_on_create = try(each.value.overwrite_on_create, true)
304304
# Keep the defaults from 4.x
305-
commit_author = try(local.resources[each.value].github_repository_file.this[each.key].commit_author, "GitHub")
306-
commit_email = try(local.resources[each.value].github_repository_file.this[each.key].commit_email, "noreply@github.com")
307-
commit_message = try(local.resources[each.value].github_repository_file.this[each.key].commit_message, "chore: Update ${each.value.file} [skip ci]")
305+
commit_author = try(each.value.commit_author, "GitHub")
306+
commit_email = try(each.value.commit_email, "noreply@github.com")
307+
commit_message = try(each.value.commit_message, "chore: Update ${each.value.file} [skip ci]")
308308

309309
lifecycle {
310310
ignore_changes = []
@@ -327,16 +327,16 @@ resource "github_issue_label" "this" {
327327
} if try(regex("^${repository}:", label), null) != null
328328
]
329329
])
330-
]) : item.index => item.source
330+
]) : item.index => local.resources[item.source].github_issue_label.this[item.index]
331331
}
332332

333333
depends_on = [github_repository.this]
334334

335-
repository = local.resources[each.value].github_issue_label.this[each.key].repository
336-
name = local.resources[each.value].github_issue_label.this[each.key].name
335+
repository = each.value.repository
336+
name = each.value.name
337337

338-
color = try(local.resources[each.value].github_issue_label.this[each.key].color, null)
339-
description = try(local.resources[each.value].github_issue_label.this[each.key].description, null)
338+
color = try(each.value.color, null)
339+
description = try(each.value.description, null)
340340

341341
lifecycle {
342342
ignore_changes = []

0 commit comments

Comments
 (0)