scalr_webhook

Resource: scalr_webhook

Manage the state of webhooks in Scalr. Creates, updates and destroy.

Example Usage

resource "scalr_webhook" "example1" {
  name         = "my-webhook-1"
  enabled      = true
  url          = "https://my-endpoint.url"
  secret_key   = "my-secret-key"
  timeout      = 15
  max_attempts = 3
  events       = ["run:completed", "run:errored"]
  environments = ["env-xxxxxxxxxx"]
  header {
    name  = "header1"
    value = "value1"
  }
  header {
    name  = "header2"
    value = "value2"
  }
}

# Old-style webhook resource (deprecated):
resource "scalr_webhook" "example2" {
  name           = "my-webhook-2"
  enabled        = true
  endpoint_id    = "ep-xxxxxxxxxx"
  events         = ["run:completed", "run:errored"]
  workspace_id   = "ws-xxxxxxxxxx"
  environment_id = "env-xxxxxxxxxx"
}

Schema

Required

  • events (List of String) List of event IDs.
  • name (String) Name of the webhook.

Optional

  • account_id (String) ID of the account, in the format acc-<RANDOM STRING>.
  • enabled (Boolean) Set (true/false) to enable/disable the webhook.
  • endpoint_id (String, Deprecated) ID of the endpoint, in the format ep-<RANDOM STRING>.
  • environment_id (String, Deprecated) ID of the environment, in the format env-<RANDOM STRING>.
  • environments (Set of String) The list of environment identifiers that the webhook is shared to. Use ["*"] to share with all environments.
  • header (Block Set) Additional headers to set in the webhook request. (see below for nested schema)
  • max_attempts (Number) Max delivery attempts of the payload.
  • secret_key (String, Sensitive) Secret key to sign the webhook payload.
  • timeout (Number) Endpoint timeout (in seconds).
  • url (String) Endpoint URL. Required if endpoint_id is not set.
  • workspace_id (String, Deprecated) ID of the workspace, in the format ws-<RANDOM STRING>.

Read-Only

  • id (String) The ID of this resource.
  • last_triggered_at (String) Date/time when webhook was last triggered.

Nested Schema for header

Required:

  • name (String) The name of the header.
  • value (String) The value of the header.

Import

Import is supported using the following syntax:

terraform import scalr_webhook.example wh-xxxxxxxxxx