forked from smaftoul/terraform-github-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
636 lines (547 loc) · 20.3 KB
/
variables.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
# ---------------------------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# These variables must be set when using this module.
# ---------------------------------------------------------------------------------------------------------------------
variable "name" {
description = "(Required) The name of the repository."
type = string
}
# ---------------------------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# These variables have defaults, but may be overridden.
# ---------------------------------------------------------------------------------------------------------------------
variable "branches" {
description = "(Optional) A list of branches to be created in this repository."
type = any
# type = list(object({
# name = string
# source_branch = optional(string)
# source_sha = optional(string)
# }))
default = []
}
variable "defaults" {
description = "(Deprecated) DEPRECATED. Please convert defaults to Terraform Module for_each"
type = any
# Example:
# defaults = {
# homepage_url = "https://mineiros.io/"
# visibility = "private"
# has_issues = false
# has_projects = false
# has_wiki = false
# has_downloads = false
# delete_branch_on_merge = true
# is_template = true
# allow_merge_commit = true
# allow_rebase_merge = false
# allow_squash_merge = false
# allow_auto_merge = false
# auto_init = true
# gitignore_template = "terraform"
# license_template = "mit"
# default_branch = "main"
# topics = ["topic-1", "topic-2"]
# template = "terraform-module-template"
# vulnerability_alerts = true
# ignore_vulnerability_alerts_during_read = true
# issue_labels_create = false
# squash_merge_commit_title = "PR_TITLE"
# squash_merge_commit_message = "COMMIT_MESSAGES"
# merge_commit_title = "PR_TITLE"
# merge_commit_message = "PR_BODY"
# vulnerability_alerts = true
# ignore_vulnerability_alerts_during_read = true
# }
default = {}
}
variable "description" {
description = "(Optional) A description of the repository."
type = string
default = ""
}
variable "homepage_url" {
description = "(Optional) The website of the repository."
type = string
default = null
}
variable "private" {
description = "(Optional) (DEPRECATED: use visibility)"
type = bool
default = null
}
variable "visibility" {
description = "(Optional) Can be 'public', 'private' or 'internal' (GHE only).The visibility parameter overrides the private parameter. Defaults to 'private' if neither private nor visibility are set, default to state of private parameter if it is set."
type = string
default = null
}
variable "has_issues" {
description = "(Optional) Set to true to enable the GitHub Issues features on the repository. (Default: false)"
type = bool
default = null
}
variable "has_projects" {
description = "(Optional) Set to true to enable the GitHub Projects features on the repository. Per the github documentation when in an organization that has disabled repository projects it will default to false and will otherwise default to true. If you specify true when it has been disabled it will return an error. (Default: false)"
type = bool
default = null
}
variable "has_wiki" {
description = "(Optional) Set to true to enable the GitHub Wiki features on the repository. (Default: false)"
type = bool
default = null
}
variable "allow_merge_commit" {
description = "(Optional) Set to false to disable merge commits on the repository. (Default: true)"
type = bool
default = null
}
variable "allow_squash_merge" {
description = "(Optional) Set to true to enable squash merges on the repository. (Default: false)"
type = bool
default = null
}
variable "allow_rebase_merge" {
description = "(Optional) Set to true to enable rebase merges on the repository. (Default: false)"
type = bool
default = null
}
variable "allow_auto_merge" {
description = "(Optional) Set to true to allow auto-merging pull requests on the repository. If enabled for a pull request, the pull request will merge automatically when all required reviews are met and status checks have passed. (Default: false)"
type = bool
default = null
}
variable "delete_branch_on_merge" {
description = "(Optional) Whether or not to delete the merged branch after merging a pull request. (Default: false)"
type = bool
default = null
}
variable "has_downloads" {
description = "(Optional) Set to true to enable the (deprecated) downloads features on the repository. (Default: false)"
type = bool
default = null
}
variable "auto_init" {
description = "(Optional) Wether or not to produce an initial commit in the repository. (Default: true)"
type = bool
default = null
}
variable "pages" {
description = "(Optional) The repository's GitHub Pages configuration. (Default: {})"
# type = object({
# branch = string
# path = string
# cname = string
# })
type = any
default = null
}
variable "gitignore_template" {
description = "(Optional) Use the name of the template without the extension. For example, Haskell. Available templates: https://github.com/github/gitignore"
type = string
default = null
}
variable "is_template" {
description = "(Optional) Whether or not to tell GitHub that this is a template repository. ( Default: false)"
type = bool
default = null
}
variable "license_template" {
description = "(Optional) Use the name of the template without the extension. For example, 'mit' or 'mpl-2.0'. Available licences: https://github.com/github/choosealicense.com/tree/gh-pages/_licenses"
type = string
default = null
}
variable "default_branch" {
description = "(Optional) The name of the default branch of the repository. NOTE: This can only be set after a repository has already been created, and after a correct reference has been created for the target branch inside the repository. This means a user will have to omit this parameter from the initial repository creation and create the target branch inside of the repository prior to setting this attribute."
type = string
default = null
}
variable "archived" {
description = "(Optional) Specifies if the repository should be archived. (Default: false)"
type = bool
default = false
}
variable "topics" {
description = "(Optional) The list of topics of the repository. (Default: [])"
type = list(string)
default = null
}
variable "extra_topics" {
description = "(Optional) The list of additional topics of the repository. (Default: [])"
type = list(string)
default = []
}
variable "template" {
description = "(Optional) Template repository to use. (Default: {})"
type = object({
owner = string
repository = string
})
default = null
}
variable "admin_collaborators" {
description = "(Optional) A list of users to add as collaborators granting them admin (full) permission."
type = list(string)
default = []
}
variable "push_collaborators" {
description = "(Optional) A list of users to add as collaborators granting them push (read-write) permission."
type = list(string)
default = []
}
variable "pull_collaborators" {
description = "(Optional) A list of users to add as collaborators granting them pull (read-only) permission."
type = list(string)
default = []
}
variable "triage_collaborators" {
description = "(Optional) A list of users to add as collaborators granting them triage permission."
type = list(string)
default = []
}
variable "maintain_collaborators" {
description = "(Optional) A list of users to add as collaborators granting them maintain permission."
type = list(string)
default = []
}
variable "admin_team_ids" {
description = "(Optional) A list of teams (by id) to grant admin (full) permission to."
type = list(string)
default = []
}
variable "push_team_ids" {
description = "(Optional) A list of teams (by id) to grant push (read-write) permission to."
type = list(string)
default = []
}
variable "pull_team_ids" {
description = "(Optional) A list of teams (by id) to grant pull (read-only) permission to."
type = list(string)
default = []
}
variable "triage_team_ids" {
description = "(Optional) A list of teams (by id) to grant triage permission to."
type = list(string)
default = []
}
variable "maintain_team_ids" {
description = "(Optional) A list of teams (by id) to grant maintain permission to."
type = list(string)
default = []
}
variable "admin_teams" {
description = "(Optional) A list of teams (by name/slug) to grant admin (full) permission to."
type = list(string)
default = []
}
variable "push_teams" {
description = "(Optional) A list of teams (by name/slug) to grant push (read-write) permission to."
type = list(string)
default = []
}
variable "pull_teams" {
description = "(Optional) A list of teams (by name/slug) to grant pull (read-only) permission to."
type = list(string)
default = []
}
variable "triage_teams" {
description = "(Optional) A list of teams (by name/slug) to grant triage permission to."
type = list(string)
default = []
}
variable "maintain_teams" {
description = "(Optional) A list of teams (by name/slug) to grant maintain permission to."
type = list(string)
default = []
}
variable "branch_protections_v3" {
description = "(Optional) A list of branch protections to apply to the repository. Default is [] unless branch_protections is set."
type = any
# We can't use a detailed type specification due to a terraform limitation. However, this might be changed in a future
# Terraform version. See https://github.com/hashicorp/terraform/issues/19898 and https://github.com/hashicorp/terraform/issues/22449
#
# type = list(object({
# branch = string
# enforce_admins = bool
# require_signed_commits = bool
# required_status_checks = object({
# strict = bool
# contexts = list(string)
# })
# required_pull_request_reviews = object({
# dismiss_stale_reviews = bool
# dismissal_users = list(string)
# dismissal_teams = list(string)
# require_code_owner_reviews = bool
# required_approving_review_count = number
# })
# restrictions = object({
# users = list(string)
# teams = list(string)
# })
# }))
default = []
# Example:
# branch_protections = [
# {
# branch = "main"
# enforce_admins = true
# require_signed_commits = true
#
# required_status_checks = {
# strict = false
# contexts = ["ci/travis"]
# }
#
# required_pull_request_reviews = {
# dismiss_stale_reviews = true
# dismissal_users = ["user1", "user2"]
# dismissal_teams = ["team-slug-1", "team-slug-2"]
# require_code_owner_reviews = true
# required_approving_review_count = 1
# }
#
# restrictions = {
# users = ["user1"]
# teams = ["team-slug-1"]
# }
# }
# ]
}
variable "branch_protections_v4" {
description = "(Optional) A list of v4 branch protections to apply to the repository. Default is []."
type = any
# type = list(
# object(
# {
# pattern = string
# allows_deletions = optional(bool, false)
# allows_force_pushes = optional(bool, false)
# blocks_creations = optional(bool, false)
# enforce_admins = optional(bool, false)
# push_restrictions = optional(list(string), [])
# require_conversation_resolution = optional(bool, false)
# require_signed_commits = optional(bool, false)
# required_linear_history = optional(bool, false)
# required_pull_request_reviews = optional(object(
# {
# dismiss_stale_reviews = optional(bool, false)
# dismissal_restrictions = optional(list(string), [])
# pull_request_bypassers = optional(list(string), [])
# require_code_owner_reviews = optional(bool, false)
# required_approving_review_count = optional(number, 0)
# }
# ))
# required_status_checks = optional(object(
# {
# strict = optional(bool, false)
# contexts = optional(list(string), [])
# }
# ))
# }
# )
# )
default = []
validation {
condition = alltrue(
[
for cfg in var.branch_protections_v4 : try(
cfg.required_pull_request_reviews.required_approving_review_count >= 0
&& cfg.required_pull_request_reviews.required_approving_review_count <= 6,
true
)
]
)
error_message = "The value for branch_protections_v4.required_pull_request_reviews.required_approving_review_count must be between 0 and 6, inclusively."
}
}
variable "issue_labels_merge_with_github_labels" {
description = "(Optional) Specify if you want to merge and control githubs default set of issue labels."
type = bool
default = null
}
variable "issue_labels_create" {
description = "(Optional) Specify whether you want to force or suppress the creation of issues labels."
type = bool
default = null
}
variable "issue_labels" {
description = "(Optional) Configure a GitHub issue label resource."
type = list(object({
name = string
description = string
color = string
}))
# Example:
# issue_labels = [
# {
# name = "WIP"
# description = "Work in Progress..."
# color = "d6c860"
# },
# {
# name = "another-label"
# description = "This is a lable created by Terraform..."
# color = "1dc34f"
# }
# ]
default = []
}
variable "deploy_keys" {
description = "(Optional) Configure a deploy key ( SSH key ) that grants access to a single GitHub repository. This key is attached directly to the repository instead of to a personal user account."
type = any
# Example:
# deploy_keys = [
# {
# title = "CI User Deploy Key"
# key = "ssh-rsa AAAAB3NzaC1yc2...."
# read_only = true
# },
# {
# title = "Test Key"
# key = "ssh-rsa AAAAB3NzaC1yc2...."
# read_only = false
# }
# ]
default = []
}
variable "deploy_keys_computed" {
description = "(Optional) Configure a deploy key ( SSH key ) that grants access to a single GitHub repository. This key is attached directly to the repository instead of to a personal user account."
type = any
# Example:
# deploy_keys_computed = [
# {
# title = "CI User Deploy Key"
# key = computed.resource
# read_only = true
# }
# ]
default = []
}
variable "projects" {
description = "(Optional) Create and manage projects for GitHub repository."
type = list(object({
name = string
body = string
}))
# Example:
# projects = [
# {
# name = "Testproject"
# body = "This is a fancy test project for testing"
# }
# ]
default = []
}
variable "webhooks" {
description = "(Optional) Configuring webhooks. For details please check: https://www.terraform.io/docs/providers/github/r/repository_webhook.html"
type = any
# We can't use a detailed type specification due to a terraform limitation. However, this might be changed in a future
# Terraform version. See https://github.com/hashicorp/terraform/issues/19898 and https://github.com/hashicorp/terraform/issues/22449
#
# type = list(object({
# name = string
# active = bool
# events = list(string)
# url = string
# content_type = string
# insecure_ssl = bool
# secret = string
# }))
default = []
# Example:
# webhooks = [{
# active = false
# events = ["issues"]
# url = "https://google.de/"
# content_type = "form"
# insecure_ssl = false
# }]
}
variable "plaintext_secrets" {
description = "(Optional) Configuring actions secrets. For details please check: https://www.terraform.io/docs/providers/github/r/actions_secret"
type = map(string)
# Example:
# plaintext_secrets = {
# "MY_SECRET" = "42"
# "OWN_TOKEN" = "12345"
# }
default = {}
}
variable "encrypted_secrets" {
description = "(Optional) Configuring encrypted actions secrets. For details please check: https://www.terraform.io/docs/providers/github/r/actions_secret"
type = map(string)
# Example:
# encrypted_secrets = {
# "MY_ENCRYPTED_SECRET" = "MTIzNDU="
# }
default = {}
}
variable "autolink_references" {
description = "(Optional) Configuring autolink references. For details please check: https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_autolink_reference"
type = list(object({
key_prefix = string
target_url_template = string
}))
# Example:
# autolink_references = [
# {
# key_prefix = "TICKET-"
# target_url_template = "https://hello.there/TICKET?query=<num>"
# }
# ]
default = []
}
variable "vulnerability_alerts" {
type = bool
description = "(Optional) Set to `false` to disable security alerts for vulnerable dependencies. Enabling requires alerts to be enabled on the owner level."
default = null
}
variable "ignore_vulnerability_alerts_during_read" {
type = bool
description = "(Optional) Set to `true` to not call the vulnerability alerts endpoint so the resource can also be used without admin permissions during read."
default = null
}
variable "archive_on_destroy" {
type = string
description = "(Optional) Set to `false` to not archive the repository instead of deleting on destroy."
default = true
}
variable "app_installations" {
type = set(string)
description = "(Optional) A list of GitHub App IDs to be installed in this repository."
default = []
}
variable "squash_merge_commit_title" {
type = string
description = "(Optional) Can be `PR_BODY`, `COMMIT_MESSAGES`, or `BLANK` for a default squash merge commit message."
default = "COMMIT_OR_PR_TITLE"
}
variable "squash_merge_commit_message" {
type = string
description = "(Optional) Can be `PR_BODY`, `COMMIT_MESSAGES`, or `BLANK` for a default squash merge commit message."
default = "COMMIT_MESSAGES"
}
variable "merge_commit_title" {
type = string
description = "(Optional) Can be `PR_TITLE` or `MERGE_MESSAGE` for a default merge commit title."
default = "MERGE_MESSAGE"
}
variable "merge_commit_message" {
type = string
description = "(Optional) Can be `PR_BODY`, `PR_TITLE`, or `BLANK` for a default merge commit message."
default = "PR_TITLE"
}
# ------------------------------------------------------------------------------
# MODULE CONFIGURATION PARAMETERS
# These variables are used to configure the module.
# ------------------------------------------------------------------------------
variable "module_depends_on" {
type = any
description = "(Optional) Define resources this module indirectly depends_on."
default = []
}
variable "allow_update_branch" {
description = "(Optional) Set to true to always suggest updating pull request branches."
type = bool
default = false
}