# dokploy_discord_notification (Resource)

A Discord notification channel (Settings > Notifications). Dokploy posts each message to a channel webhook.

Each event attribute selects one Dokploy event that sends a message on this channel. All events default to `false`, so a new channel sends nothing until you enable one.

~> Dokploy does not test the channel on create or update. A wrong URL or token applies successfully and fails on the first message.

~> **Dokploy stores and returns `webhook_url` in cleartext.** The attribute is sensitive, so Terraform does not print it, but anyone with API access to the server can read it. The `webhook_url_wo` companion keeps it out of the Terraform state.

## Example Usage

```terraform
# Post every backup result to a Discord channel, as a plain message.
resource "dokploy_discord_notification" "backups" {
  name        = "backups"
  webhook_url = var.discord_webhook_url
  decoration  = false

  database_backup = true
  volume_backup   = true
  dokploy_backup  = true
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Display name. Dokploy does not enforce a unique name.

### Optional

> **NOTE**: [Write-only arguments](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments) are supported in Terraform 1.11 and later.

- `app_build_error` (Boolean) Send a message when a build fails. Defaults to `false`.
- `app_deploy` (Boolean) Send a message when an application or a compose deploys. Defaults to `false`.
- `database_backup` (Boolean) Send a message when a database backup runs. Defaults to `false`.
- `decoration` (Boolean) Send the message as a rich embed with colors and the Dokploy icon. Defaults to `true`.
- `docker_cleanup` (Boolean) Send a message when the Docker cleanup runs. Defaults to `false`.
- `dokploy_backup` (Boolean) Send a message when the Dokploy server backup runs. Defaults to `false`.
- `dokploy_restart` (Boolean) Send a message when Dokploy restarts. Defaults to `false`.
- `server_threshold` (Boolean) Send a message when a server crosses a resource threshold. Defaults to `false`.
- `volume_backup` (Boolean) Send a message when a volume backup runs. Defaults to `false`.
- `webhook_url` (String, Sensitive) Webhook URL of the Discord channel. Set this attribute or `webhook_url_wo`.
- `webhook_url_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Write-only form of `webhook_url`. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Set exactly one of `webhook_url` and `webhook_url_wo`. A new value reaches the server only when `webhook_url_wo_version` changes.
- `webhook_url_wo_version` (Number) Version of `webhook_url_wo`. Change it to send the current `webhook_url_wo` value to the server. It needs `webhook_url_wo`.

### Read-Only

- `created_at` (String) Creation timestamp from the server.
- `id` (String) Notification id.

## 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
terraform import dokploy_discord_notification.example INt_PYqh9apo8mmDIoixZ
```