Skip to content

Latest commit

 

History

History
85 lines (67 loc) · 2.56 KB

File metadata and controls

85 lines (67 loc) · 2.56 KB
page_title forgejo_repository_webhook Resource - forgejo
subcategory
description Forgejo repository webhook resource.

forgejo_repository_webhook (Resource)

Forgejo repository webhook resource.

Example Usage

terraform {
  required_providers {
    forgejo = {
      source = "svalabs/forgejo"
    }
  }
}

provider "forgejo" {
  host = "http://localhost:3000"
}

# Personal repository
resource "forgejo_repository" "personal" {
  name = "personal_test_repo"
}

# Repository webhook
resource "forgejo_repository_webhook" "example" {
  repository_id        = forgejo_repository.personal.id
  authorization_header = "Bearer token123456"
  branch_filter        = "*"
  type                 = "forgejo"
  events               = ["push"]
  config = {
    "content_type" = "json"
    "url"          = "http://example.com/invoke"
    # The "secret" key is write-only: never read back from the API.
    "secret" = "supersecret"
  }
}

# Import repository webhook
# id follows the format: <owner>/<repo>/<webhook_id>
import {
  id = "tfadmin/personal_test_repo/123"
  to = forgejo_repository_webhook.example
}

Schema

Required

  • config (Map of String) Map of configuration settings, e.g. "content_type" and "url". The "secret" key is write-only: Forgejo accepts it on create/update but never returns it, so the provider preserves the configured value instead of reading it back, and cannot detect changes made outside of Terraform.
  • repository_id (Number) Numeric identifier of the repository. Changing this forces a new resource to be created.
  • type (String) Type of webhook. Changing this forces a new resource to be created.

Optional

  • active (Boolean) Boolean indicating if the webhook is active.
  • authorization_header (String, Sensitive) Authorization header to send to the target.
  • branch_filter (String) List of allowed branches for push, branch creation and branch deletion events, specified as glob pattern. If empty or *, events for all branches are reported.
  • events (Set of String) List of events which trigger the webhook.

Read-Only

  • created_at (String) Time at which the webhook was created.
  • updated_at (String) Time at which the webhook was updated.
  • webhook_id (Number) Numeric identifier of the webhook.

Import

Import is supported using the following syntax:

# Import using the repo_owner/repo_name/webhook_id.
terraform import forgejo_repository_webhook.example tfadmin/personal_test_repo/123