@@ -5,11 +5,11 @@ resource "github_membership" "this" {
5
5
source = " config"
6
6
index = member
7
7
}
8
- ] : item. index => item. source
8
+ ] : item. index => local . resources [ item . source ] . github_membership . this [ item . index ]
9
9
}
10
10
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
13
13
14
14
lifecycle {
15
15
ignore_changes = []
@@ -28,41 +28,41 @@ resource "github_repository" "this" {
28
28
source = " config"
29
29
index = repository
30
30
}
31
- ] : item.index = > item.source
31
+ ] : item.index = > local.resources[ item.source].github_repository.this[item.index]
32
32
}
33
33
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 )
63
63
64
64
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 , [])
66
66
67
67
content {
68
68
dynamic "advanced_security" {
@@ -87,7 +87,7 @@ resource "github_repository" "this" {
87
87
}
88
88
89
89
dynamic "pages" {
90
- for_each = try (local . resources [ each . value ] . github_repository . this [ each . key ] . pages , [])
90
+ for_each = try (each. value . pages , [])
91
91
content {
92
92
cname = try (pages. value [" cname" ], null )
93
93
dynamic "source" {
@@ -100,7 +100,7 @@ resource "github_repository" "this" {
100
100
}
101
101
}
102
102
dynamic "template" {
103
- for_each = try (local . resources [ each . value ] . github_repository . this [ each . key ] . template , [])
103
+ for_each = try (each. value . template , [])
104
104
content {
105
105
owner = template. value [" owner" ]
106
106
repository = template. value [" repository" ]
@@ -129,14 +129,14 @@ resource "github_repository_collaborator" "this" {
129
129
} if try (regex (" ^${ repository } :" , member), null ) != null
130
130
]
131
131
])
132
- ]) : item. index => item. source
132
+ ]) : item. index => local . resources [ item . source ] . github_repository_collaborator . this [ item . index ]
133
133
}
134
134
135
135
depends_on = [github_repository . this ]
136
136
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
140
140
141
141
lifecycle {
142
142
ignore_changes = []
@@ -159,27 +159,27 @@ resource "github_branch_protection" "this" {
159
159
} if try (regex (" ^${ repository } :" , branch_protection), null ) != null
160
160
]
161
161
])
162
- ]) : item. index => item. source
162
+ ]) : item. index => local . resources [ item . source ] . github_branch_protection . this [ item . index ]
163
163
}
164
164
165
165
depends_on = [github_repository . this ]
166
166
167
- pattern = local . resources [ each . value ] . github_branch_protection . this [ each . key ] . pattern
167
+ pattern = each. value . pattern
168
168
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 )
170
170
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 )
180
180
181
181
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 , [])
183
183
content {
184
184
dismiss_stale_reviews = try (required_pull_request_reviews. value [" dismiss_stale_reviews" ], null )
185
185
dismissal_restrictions = try (required_pull_request_reviews. value [" dismissal_restrictions" ], null )
@@ -190,7 +190,7 @@ resource "github_branch_protection" "this" {
190
190
}
191
191
}
192
192
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 )
194
194
content {
195
195
contexts = try (required_status_checks. value [" contexts" ], null )
196
196
strict = try (required_status_checks. value [" strict" ], null )
@@ -205,15 +205,15 @@ resource "github_team" "this" {
205
205
source = " config"
206
206
index = team
207
207
}
208
- ] : item. index => item. source
208
+ ] : item. index => local . resources [ item . source ] . github_team . this [ item . index ]
209
209
}
210
210
211
- name = local . resources [ each . value ] . github_team . this [ each . key ] . name
211
+ name = each. value . name
212
212
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 )
214
214
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 )
217
217
218
218
lifecycle {
219
219
ignore_changes = []
@@ -236,15 +236,15 @@ resource "github_team_repository" "this" {
236
236
} if try (regex (" :${ repository } $" , team), null ) != null
237
237
]
238
238
])
239
- ]) : item. index => item. source
239
+ ]) : item. index => local . resources [ item . source ] . github_team_repository . this [ item . index ]
240
240
}
241
241
242
242
depends_on = [github_team . this , github_repository . this ]
243
243
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
246
246
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 )
248
248
249
249
lifecycle {
250
250
ignore_changes = []
@@ -258,15 +258,15 @@ resource "github_team_membership" "this" {
258
258
source = " config"
259
259
index = member
260
260
}
261
- ] : item. index => item. source
261
+ ] : item. index => local . resources [ item . source ] . github_team_membership . this [ item . index ]
262
262
}
263
263
264
264
depends_on = [github_team . this ]
265
265
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
268
268
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 )
270
270
271
271
lifecycle {
272
272
ignore_changes = []
@@ -289,22 +289,22 @@ resource "github_repository_file" "this" {
289
289
} if try (regex (" ^${ repository } /" , file), null ) != null
290
290
]
291
291
])
292
- ]) : item. index => item. source
292
+ ]) : item. index => local . resources [ item . source ] . github_repository_file . this [ item . index ]
293
293
}
294
294
295
295
depends_on = [github_repository . this ]
296
296
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
300
300
# Since 5.25.0 the branch attribute defaults to the default branch of the repository
301
301
# 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 )
304
304
# 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]" )
308
308
309
309
lifecycle {
310
310
ignore_changes = []
@@ -327,16 +327,16 @@ resource "github_issue_label" "this" {
327
327
} if try (regex (" ^${ repository } :" , label), null ) != null
328
328
]
329
329
])
330
- ]) : item. index => item. source
330
+ ]) : item. index => local . resources [ item . source ] . github_issue_label . this [ item . index ]
331
331
}
332
332
333
333
depends_on = [github_repository . this ]
334
334
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
337
337
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 )
340
340
341
341
lifecycle {
342
342
ignore_changes = []
0 commit comments