@@ -28,7 +28,8 @@ A [Terraform] module for creating a public or private repository on [Github].
28
28
- [ Collaborator Configuration] ( #collaborator-configuration )
29
29
- [ Branches Configuration] ( #branches-configuration )
30
30
- [ Deploy Keys Configuration] ( #deploy-keys-configuration )
31
- - [ Branch Protections Configuration] ( #branch-protections-configuration )
31
+ - [ Branch Protections v3 Configuration] ( #branch-protections-v3-configuration )
32
+ - [ Branch Protections v4 Configuration] ( #branch-protections-v4-configuration )
32
33
- [ Issue Labels Configuration] ( #issue-labels-configuration )
33
34
- [ Projects Configuration] ( #projects-configuration )
34
35
- [ Webhooks Configuration] ( #webhooks-configuration )
@@ -103,25 +104,12 @@ Most basic usage creating a new private github repository.
103
104
``` hcl
104
105
module "repository" {
105
106
source = "mineiros-io/repository/github"
106
- version = "~> 0.16 .0"
107
+ version = "~> 0.18 .0"
107
108
108
109
name = "terraform-github-repository"
109
110
license_template = "apache-2.0"
110
111
gitignore_template = "Terraform"
111
112
}
112
-
113
- provider "github" {}
114
-
115
- terraform {
116
- required_version = "~> 1.0"
117
-
118
- required_providers {
119
- github = {
120
- source = "integrations/github"
121
- version = "~> 4.0"
122
- }
123
- }
124
- }
125
113
```
126
114
127
115
## Module Argument Reference
@@ -136,32 +124,10 @@ See [variables.tf] and [examples/] for details and use-cases.
136
124
137
125
- [ ** ` defaults ` ** ] ( #var-defaults ) : * (Optional ` object(defaults) ` )* <a name =" var-defaults " ></a >
138
126
139
- A object of default settings to use instead of module defaults for top-level arguments.
140
- See below for a list of supported arguments.
141
-
142
- This is a special argument to set various defaults to be reused for multiple repositories.
143
-
144
- The following top-level arguments can be set as defaults:
145
- ` homepage_url ` ,
146
- ` visibility ` ,
147
- ` has_issues ` ,
148
- ` has_projects ` ,
149
- ` has_wiki ` ,
150
- ` allow_merge_commit ` ,
151
- ` allow_rebase_merge ` ,
152
- ` allow_squash_merge ` ,
153
- ` allow_auto_merge ` ,
154
- ` has_downloads ` ,
155
- ` auto_init ` ,
156
- ` gitignore_template ` ,
157
- ` license_template ` ,
158
- ` default_branch ` ,
159
- ` topics ` ,
160
- ` issue_labels_create ` ,
161
- ` issue_labels_merge_with_github_labels ` .
162
-
163
- Module defaults are used for all arguments that are not set in ` defaults ` .
164
- Using top level arguments override defaults set by this argument.
127
+ DEPRECATED:
128
+ This variable will be removed in future releases.
129
+ It was needed in times when Terraform Module for each was not available to provide default values for multiple repositories.
130
+ Please convert your code accordingly to stay compatible with future releases.
165
131
166
132
Default is ` {} ` .
167
133
@@ -528,11 +494,11 @@ This is due to some terraform limitation and we will update the module once terr
528
494
529
495
Default is ` "md5(key)" ` .
530
496
531
- #### Branch Protections Configuration
497
+ #### Branch Protections v3 Configuration
532
498
533
499
- [ ** ` branch_protections_v3 ` ** ] ( #var-branch_protections_v3 ) : * (Optional ` list(branch_protection_v3) ` )* <a name =" var-branch_protections_v3 " ></a >
534
500
535
- This resource allows you to configure branch protection for repositories in your organization.
501
+ This resource allows you to configure v3 branch protection for repositories in your organization.
536
502
When applied, the branch will be protected from forced pushes and deletion.
537
503
Additional constraints, such as required status checks or restrictions on users and teams, can also be configured.
538
504
@@ -645,13 +611,144 @@ This is due to some terraform limitation and we will update the module once terr
645
611
646
612
Default is ` [] ` .
647
613
648
- - [ ** ` branch_protections ` ** ] ( #var-branch_protections ) : * (Optional ` list(branch_protection_v3) ` )* <a name =" var-branch_protections " ></a >
614
+ #### Branch Protections v4 Configuration
615
+
616
+ - [ ** ` branch_protections_v4 ` ** ] ( #var-branch_protections_v4 ) : * (Optional ` list(branch_protection_v4) ` )* <a name =" var-branch_protections_v4 " ></a >
617
+
618
+ This resource allows you to configure v4 branch protection for repositories in your organization.
619
+
620
+ Each element in the list is a branch to be protected and the value the corresponding to the desired configuration for the branch.
621
+
622
+ When applied, the branch will be protected from forced pushes and deletion.
623
+ Additional constraints, such as required status checks or restrictions on users and teams, can also be configured.
649
624
650
- ** _ DEPRECATED_ ** To ensure compatibility with future versions of this module, please use ` branch_protections_v3 ` .
651
- This argument is ignored if ` branch_protections_v3 ` is used. Please see ` branch_protections_v3 ` for supported attributes.
625
+ ** _ NOTE:_ ** May conflict with v3 branch protections if used for the same branch.
652
626
653
627
Default is ` [] ` .
654
628
629
+ Each ` branch_protection_v4 ` object in the list accepts the following attributes:
630
+
631
+ - [ ** ` pattern ` ** ] ( #attr-branch_protections_v4-pattern ) : * (** Required** ` string ` )* <a name =" attr-branch_protections_v4-pattern " ></a >
632
+
633
+ Identifies the protection rule pattern.
634
+
635
+ - [ ** ` _key ` ** ] ( #attr-branch_protections_v4-_key ) : * (Optional ` string ` )* <a name =" attr-branch_protections_v4-_key " ></a >
636
+
637
+ An alternative key to use in ` for_each ` resource creation.
638
+ Defaults to the value of ` var.pattern ` .
639
+
640
+ - [ ** ` allows_deletions ` ** ] ( #attr-branch_protections_v4-allows_deletions ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-allows_deletions " ></a >
641
+
642
+ Setting this to ` true ` to allow the branch to be deleted.
643
+
644
+ Default is ` false ` .
645
+
646
+ - [ ** ` allows_force_pushes ` ** ] ( #attr-branch_protections_v4-allows_force_pushes ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-allows_force_pushes " ></a >
647
+
648
+ Setting this to ` true ` to allow force pushes on the branch.
649
+
650
+ Default is ` false ` .
651
+
652
+ - [ ** ` blocks_creations ` ** ] ( #attr-branch_protections_v4-blocks_creations ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-blocks_creations " ></a >
653
+
654
+ Setting this to ` true ` will block creating the branch.
655
+
656
+ Default is ` false ` .
657
+
658
+ - [ ** ` enforce_admins ` ** ] ( #attr-branch_protections_v4-enforce_admins ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-enforce_admins " ></a >
659
+
660
+ Keeping this as ` true ` enforces status checks for repository administrators.
661
+
662
+ Default is ` true ` .
663
+
664
+ - [ ** ` push_restrictions ` ** ] ( #attr-branch_protections_v4-push_restrictions ) : * (Optional ` list(string) ` )* <a name =" attr-branch_protections_v4-push_restrictions " ></a >
665
+
666
+ The list of actor Names/IDs that may push to the branch.
667
+ Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams.
668
+
669
+ Default is ` [] ` .
670
+
671
+ - [ ** ` require_conversation_resolution ` ** ] ( #attr-branch_protections_v4-require_conversation_resolution ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-require_conversation_resolution " ></a >
672
+
673
+ Setting this to true requires all conversations on code must be resolved before a pull request can be merged.
674
+
675
+ Default is ` false ` .
676
+
677
+ - [ ** ` require_signed_commits ` ** ] ( #attr-branch_protections_v4-require_signed_commits ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-require_signed_commits " ></a >
678
+
679
+ Setting this to true requires all commits to be signed with GPG.
680
+
681
+ Default is ` false ` .
682
+
683
+ - [ ** ` required_linear_history ` ** ] ( #attr-branch_protections_v4-required_linear_history ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-required_linear_history " ></a >
684
+
685
+ Setting this to true enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch.
686
+
687
+ Default is ` false ` .
688
+
689
+ - [ ** ` required_pull_request_reviews ` ** ] ( #attr-branch_protections_v4-required_pull_request_reviews ) : * (Optional ` object(required_pull_request_reviews) ` )* <a name =" attr-branch_protections_v4-required_pull_request_reviews " ></a >
690
+
691
+ Enforce restrictions for pull request reviews.
692
+
693
+ The ` required_pull_request_reviews ` object accepts the following attributes:
694
+
695
+ - [ ** ` dismiss_stale_reviews ` ** ] ( #attr-branch_protections_v4-required_pull_request_reviews-dismiss_stale_reviews ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-required_pull_request_reviews-dismiss_stale_reviews " ></a >
696
+
697
+ Dismiss approved reviews automatically when a new commit is pushed.
698
+
699
+ Default is ` true ` .
700
+
701
+ - [ ** ` restrict_dismissals ` ** ] ( #attr-branch_protections_v4-required_pull_request_reviews-restrict_dismissals ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-required_pull_request_reviews-restrict_dismissals " ></a >
702
+
703
+ Restrict pull request review dismissals.
704
+
705
+ - [ ** ` dismissal_restrictions ` ** ] ( #attr-branch_protections_v4-required_pull_request_reviews-dismissal_restrictions ) : * (Optional ` list(string) ` )* <a name =" attr-branch_protections_v4-required_pull_request_reviews-dismissal_restrictions " ></a >
706
+
707
+ The list of actor Names/IDs with dismissal access.
708
+ If not empty, ` restrict_dismissals ` is ignored
709
+ Actor names must either begin with a ` / ` for users or the organization name followed by a ` / ` for teams.
710
+
711
+ Default is ` [] ` .
712
+
713
+ - [ ** ` pull_request_bypassers ` ** ] ( #attr-branch_protections_v4-required_pull_request_reviews-pull_request_bypassers ) : * (Optional ` list(string) ` )* <a name =" attr-branch_protections_v4-required_pull_request_reviews-pull_request_bypassers " ></a >
714
+
715
+ The list of actor Names/IDs that are allowed to bypass pull request requirements.
716
+ Actor names must either begin with a ` / ` for users or the organization name followed by a ` / ` for teams.
717
+
718
+ Default is ` [] ` .
719
+
720
+ - [ ** ` require_code_owner_reviews ` ** ] ( #attr-branch_protections_v4-required_pull_request_reviews-require_code_owner_reviews ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-required_pull_request_reviews-require_code_owner_reviews " ></a >
721
+
722
+ Require an approved review in pull requests including files with a designated code owner.
723
+
724
+ Default is ` true ` .
725
+
726
+ - [ ** ` required_approving_review_count ` ** ] ( #attr-branch_protections_v4-required_pull_request_reviews-required_approving_review_count ) : * (Optional ` number ` )* <a name =" attr-branch_protections_v4-required_pull_request_reviews-required_approving_review_count " ></a >
727
+
728
+ Require x number of approvals to satisfy branch protection requirements.
729
+ If this is specified it must be a number between 0-6.
730
+
731
+ Default is ` 0 ` .
732
+
733
+ - [ ** ` required_status_checks ` ** ] ( #attr-branch_protections_v4-required_status_checks ) : * (Optional ` object(required_status_checks) ` )* <a name =" attr-branch_protections_v4-required_status_checks " ></a >
734
+
735
+ Enforce restrictions for required status checks.
736
+ See Required Status Checks below for details.
737
+
738
+ The ` required_status_checks ` object accepts the following attributes:
739
+
740
+ - [ ** ` strict ` ** ] ( #attr-branch_protections_v4-required_status_checks-strict ) : * (Optional ` bool ` )* <a name =" attr-branch_protections_v4-required_status_checks-strict " ></a >
741
+
742
+ Require branches to be up to date before merging.
743
+
744
+ Default is ` false ` .
745
+
746
+ - [ ** ` contexts ` ** ] ( #attr-branch_protections_v4-required_status_checks-contexts ) : * (Optional ` list(string) ` )* <a name =" attr-branch_protections_v4-required_status_checks-contexts " ></a >
747
+
748
+ The list of status checks to require in order to merge into this branch. If default is ` [] ` no status checks are required.
749
+
750
+ Default is ` [] ` .
751
+
655
752
#### Issue Labels Configuration
656
753
657
754
- [ ** ` issue_labels ` ** ] ( #var-issue_labels ) : * (Optional ` list(issue_label) ` )* <a name =" var-issue_labels " ></a >
0 commit comments