diff --git a/modules/repository_base/README.md b/modules/repository_base/README.md index b7fd73e..96c38e6 100644 --- a/modules/repository_base/README.md +++ b/modules/repository_base/README.md @@ -43,7 +43,7 @@ No modules. | [has\_wiki](#input\_has\_wiki) | Enables Github Wiki for the repository | `bool` | `true` | no | | [homepage](#input\_homepage) | The homepage for the repository | `string` | `""` | no | | [name](#input\_name) | The name of the repository to create/import. | `string` | n/a | yes | -| [protected\_branches](#input\_protected\_branches) | A list of ref names or patterns that should be protected. Defaults `["main"]` | `list(string)` |
[| no | +| [protected\_branches](#input\_protected\_branches) | A list of ref names or patterns that should be protected. Setting to `[]` means no protection. Defaults `["~DEFAULT_BRANCH"]` | `list(string)` |
"main"
]
[| no | | [repository\_team\_permissions](#input\_repository\_team\_permissions) | A map where the keys are github team ids and the value is the permissions the team should have in the repository | `map(string)` | n/a | yes | | [secret\_scanning](#input\_secret\_scanning) | Enables secret scanning for the repository. If repository is private `advance_security` must also be enabled. | `bool` | `true` | no | | [secret\_scanning\_on\_push](#input\_secret\_scanning\_on\_push) | Enables secret scanning push protection for the repository. If repository is private `advance_security` must also be enabled. | `bool` | `true` | no | diff --git a/modules/repository_base/repository.tf b/modules/repository_base/repository.tf index 08c7df1..bedc2e1 100644 --- a/modules/repository_base/repository.tf +++ b/modules/repository_base/repository.tf @@ -74,7 +74,7 @@ resource "github_repository_ruleset" "protected_branch_base_rules" { conditions { ref_name { exclude = [] - include = toset(concat(["~DEFAULT_BRANCH"], local.protected_branches_refs)) + include = toset(local.protected_branches_refs) } } } diff --git a/modules/repository_base/variables.tf b/modules/repository_base/variables.tf index 0907e73..6ebaa59 100644 --- a/modules/repository_base/variables.tf +++ b/modules/repository_base/variables.tf @@ -22,8 +22,8 @@ variable "repository_team_permissions" { variable "protected_branches" { type = list(string) - description = "A list of ref names or patterns that should be protected. Defaults `[\"main\"]`" - default = ["main"] + description = "A list of ref names or patterns that should be protected. Setting to `[]` means no protection. Defaults `[\"~DEFAULT_BRANCH\"]`" + default = ["~DEFAULT_BRANCH"] } variable "has_downloads" {
"~DEFAULT_BRANCH"
]