diff --git a/README.md b/README.md index 736041f..3832127 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ No modules. | [topics](#input\_topics) | The topics of the repository | `list(string)` | `[]` | no | | [visibility](#input\_visibility) | The visibility of the repository | `string` | `"private"` | no | | [vulnerability\_alerts](#input\_vulnerability\_alerts) | Whether the repository has vulnerability alerts enabled | `bool` | `false` | no | -| [webhooks](#input\_webhooks) | The URLs of the webhooks |
list(object({
active = bool
events = list(string)
content_type = string
url = string
}))
| `[]` | no | +| [webhooks](#input\_webhooks) | Webhooks to configure for the repository |
map(object({
active = bool
events = list(string)
content_type = string
url = string
}))
| `{}` | no | ## Outputs diff --git a/main.tf b/main.tf index 073d763..1f0f8d8 100644 --- a/main.tf +++ b/main.tf @@ -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 diff --git a/variables.tf b/variables.tf index 0a53d0a..bac4d37 100644 --- a/variables.tf +++ b/variables.tf @@ -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