Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes webhook variable #22

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ No modules.
| <a name="input_topics"></a> [topics](#input\_topics) | The topics of the repository | `list(string)` | `[]` | no |
| <a name="input_visibility"></a> [visibility](#input\_visibility) | The visibility of the repository | `string` | `"private"` | no |
| <a name="input_vulnerability_alerts"></a> [vulnerability\_alerts](#input\_vulnerability\_alerts) | Whether the repository has vulnerability alerts enabled | `bool` | `false` | no |
| <a name="input_webhooks"></a> [webhooks](#input\_webhooks) | The URLs of the webhooks | <pre>list(object({<br> active = bool<br> events = list(string)<br> content_type = string<br> url = string<br> }))</pre> | `[]` | no |
| <a name="input_webhooks"></a> [webhooks](#input\_webhooks) | Webhooks to configure for the repository | <pre>map(object({<br> active = bool<br> events = list(string)<br> content_type = string<br> url = string<br> }))</pre> | `{}` | no |

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ resource "github_branch_protection" "self" {
}

resource "github_repository_webhook" "self" {
for_each = toset(var.webhooks)
for_each = { for webhook_key, webhook in var.webhooks : webhook_key => webhook }

active = each.value.active
events = each.value.events
Expand Down
6 changes: 3 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ variable "vulnerability_alerts" {
}

variable "webhooks" {
default = []
description = "The URLs of the webhooks"
type = list(object({
default = {}
description = "Webhooks to configure for the repository"
type = map(object({
active = bool
events = list(string)
content_type = string
Expand Down