Skip to content

Commit 5edf4e2

Browse files
committed
feat(tags): Allow to protect tags.
1 parent 3aa1213 commit 5edf4e2

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module "repo" {
3737
| [github_branch.default](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch) | resource |
3838
| [github_branch_default.this](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_default) | resource |
3939
| [github_repository.this](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository) | resource |
40+
| [github_repository_tag_protection.this](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_tag_protection) | resource |
4041
| [github_team.maintain](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team) | resource |
4142
| [github_team.read](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team) | resource |
4243
| [github_team.write](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team) | resource |
@@ -71,6 +72,7 @@ module "repo" {
7172
| <a name="input_homepage_url"></a> [homepage_url](#input_homepage_url) | URL of a page describing the project. | `string` | `null` | no |
7273
| <a name="input_is_template"></a> [is_template](#input_is_template) | Set to `true` to tell GitHub that this is a template repository. | `bool` | `false` | no |
7374
| <a name="input_license_template"></a> [license_template](#input_license_template) | Use the name of the template without the extension. For example, `mit` or `mpl-2.0`. | `string` | `null` | no |
75+
| <a name="input_tag_protections"></a> [tag_protections](#input_tag_protections) | List of tag patterns to protect. | `list(string)` | `[]` | no |
7476
| <a name="input_teams_maintain"></a> [teams_maintain](#input_teams_maintain) | Slugs of the teams that will be granted the 'maintain' privilege. If null, a team will be created. | `list(string)` | `[]` | no |
7577
| <a name="input_teams_read"></a> [teams_read](#input_teams_read) | Slugs of the teams that will be granted the 'pull' privilege. If null, a team will be created. | `list(string)` | `[]` | no |
7678
| <a name="input_teams_write"></a> [teams_write](#input_teams_write) | Slugs of the teams that will be granted the 'write' privilege. If null, a team will be created. | `list(string)` | `[]` | no |

main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,10 @@ resource "github_branch_default" "this" {
6060
repository = github_repository.this.name
6161
branch = var.default_branch == "main" ? "main" : github_branch.default[0].branch
6262
}
63+
64+
resource "github_repository_tag_protection" "this" {
65+
count = length(var.tag_protections)
66+
67+
repository = github_repository.this.name
68+
pattern = var.tag_protections[count.index]
69+
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,9 @@ variable "vulnerability_alerts" {
158158
type = bool
159159
default = true
160160
}
161+
162+
variable "tag_protections" {
163+
description = "List of tag patterns to protect."
164+
type = list(string)
165+
default = []
166+
}

0 commit comments

Comments
 (0)