--- page_title: "ona_webhook Resource - ona" subcategory: "Integrations and Automation" description: |- Ona webhook for receiving SCM events. Webhooks must be created with a user or administrator credential because the Ona API does not allow service accounts to create them. Changing secret_version rotates the generated signing secret and immediately invalidates its previous value; retrieve the current value with the ona_webhook_secret ephemeral resource. Removing this resource deletes the webhook and converts triggers on bound workflows to manual triggers. --- # ona_webhook (Resource) Ona webhook for receiving SCM events. Webhooks must be created with a user or administrator credential because the Ona API does not allow service accounts to create them. Changing `secret_version` rotates the generated signing secret and immediately invalidates its previous value; retrieve the current value with the `ona_webhook_secret` ephemeral resource. Removing this resource deletes the webhook and converts triggers on bound workflows to manual triggers. For product context, see [Webhooks](https://ona.com/docs/ona/automations/webhooks) and [Automation triggers](https://ona.com/docs/ona/automations/configure-automations). ## Example Usage ```terraform resource "ona_webhook" "deployments" { name = "Deployment events" description = "Receives deployment events for the platform repository." type = "repository" scm_provider = "github" secret_version = "v1" repository_scopes = [ { host = "github.com" owner = "example-organization" name = "platform" } ] } resource "ona_webhook" "organization" { name = "Organization events" description = "Receives events for all repositories in the organization." type = "organization" scm_provider = "github" secret_version = "v1" organization_scope = { host = "github.com" name = "example-organization" } } ``` ## Schema ### Required - `name` (String) Webhook display name. Must be between 1 and 80 characters. - `scm_provider` (String) SCM provider. Supported values are `github`, `gitlab`, and `bitbucket`. Changes require replacement. - `type` (String) Webhook scope type. Supported values are `repository` and `organization`. Changes require replacement. ### Optional - `description` (String) Optional description of the webhook's purpose. Must not exceed 500 characters. - `organization_scope` (Attributes) SCM organization handled by an `organization` webhook. Do not set this for a `repository` webhook. (see [below for nested schema](#nestedatt--organization_scope)) - `repository_scopes` (Attributes Set) Repositories handled by a `repository` webhook. Configure between 1 and 100 entries. Do not set this for an `organization` webhook. (see [below for nested schema](#nestedatt--repository_scopes)) - `secret_version` (String) User-managed rotation marker. Changing this value rotates the webhook signing secret during apply. The secret itself is never stored in this resource's state. ### Read-Only - `created_at` (String) Time when the webhook was created. - `creator` (Attributes) Identity that created the webhook. (see [below for nested schema](#nestedatt--creator)) - `id` (String) Webhook ID. Use this value as the Terraform import ID. - `url` (String) Generated webhook endpoint URL. ### Nested Schema for `organization_scope` Required: - `host` (String) SCM host, such as `github.com` or `gitlab.com`. - `name` (String) SCM organization or group name. ### Nested Schema for `repository_scopes` Required: - `host` (String) SCM host, such as `github.com` or `gitlab.com`. - `name` (String) Repository name. - `owner` (String) Repository owner or organization. ### Nested Schema for `creator` Read-Only: - `id` (String) Creator subject ID. - `principal` (String) Creator principal type. ## Import Import is supported using the following syntax: The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: ```shell #!/usr/bin/env sh terraform import ona_webhook.deployments 00000000-0000-0000-0000-000000000000 ```