The webhook resource manages a HCP webhook, used to notify external systems about a project resource's lifecycle events
resource "hcp_notifications_webhook" "example" {
name = "example-webhook"
description = "Notify for all of the events for all Packer artifact versions existing in the project."
config = {
url = "https://example.com"
}
subscriptions = [
{
events = [
{
actions = ["*"]
source = "hashicorp.packer.version"
}
]
}
]
}
config
(Attributes) The webhook configuration used to deliver event payloads. (see below for nested schema)name
(String) The webhook's name.description
(String) The webhook's description. Descriptions are useful for helping others understand the purpose of the webhook.enabled
(Boolean) Indicates if the webhook should receive payloads for the subscribed events. Defaults to true
.project_id
(String) The ID of the project to create the webhook under. If unspecified, the webhook will be created in the project the provider is configured with.subscriptions
(Attributes List) Set of events to subscribe the webhook to all resources or a specific resource in the project. (see below for nested schema)resource_id
(String) The webhook's unique identifier.resource_name
(String) The webhooks's resource name in the format webhook/project/<project_id>/geo/us/webhook/<name>
.config
Required:
url
(String) The HTTP or HTTPS destination URL that HCP delivers the event payloads to.
The destination must be able to use the HCP webhook
payload.Optional:
hmac_key
(String, Sensitive) The arbitrary secret that HCP uses to sign all its webhook requests. This is a write-only field, it is written once and not visible thereafter.subscriptions
Required:
events
(Attributes List) The information about the events of a webhook subscription. The service that owns the resource is responsible for maintaining events. Refer to the service's webhook documentation for more information. (see below for nested schema)Optional:
resource_id
(String) Refers to the resource the webhook is subscribed to. If not set, the webhook subscribes to the emitted events listed in events for any resource in the webhook's project.subscriptions.events
Required:
actions
(List of String) The list of event actions subscribed for the resource type set as the source. For example, ["create", "update"]
. When the action is '*', it means that the webhook is subscribed to all event actions for the event source.source
(String) The resource type of the source of the event. For example, hashicorp.packer.version
. Event source might not be the same type as the resource that the webhook is subscribed to (resource_id) if the event is from a descendant resource. For example, webhooks are subscribed to a hashicorp.packer.registry
and receive events for descendent resources such as a hashicorp.packer.version
.Import is supported using the following syntax:
# HCP Webhook can be imported by specifying the webhook resource name
# The webhook resource name is in the format webhook/project/{project_id}/geo/us/webhook/{webhook_name}
terraform import hcp_notifications_webhook.example webhook/project/840e3701-55b6-4f86-8c17-b1fe397303c5/geo/us/webhook/example-webhook