# dokploy_telemetry_provider (Resource)

A telemetry provider (Settings > Logs & Metrics): a destination for the container logs and the host metrics that a Vector agent collects. Select the provider on the Dokploy host with `telemetry_provider_ids` on `dokploy_web_server_settings`. Dokploy v0.31.0 added this feature.

~> Dokploy never returns `endpoint`, `api_key`, or `api_secret`. Terraform cannot detect a change of these values outside Terraform, and an import leaves them null. Each update sends all three again.

~> Dokploy checks that the type supports each signal and that each required field of the type has a value. It does not test the connection on create or update.

## Example Usage

```terraform
# Grafana Loki for the container logs. Loki accepts logs only.
resource "dokploy_telemetry_provider" "loki" {
  name          = "loki"
  provider_type = "loki"
  signals       = ["logs"]
  endpoint      = "https://logs.example.com/loki/api/v1/push"

  # Write-only: Terraform 1.11 or later. Change the version to start an
  # update when only the token changed.
  api_key_wo         = var.loki_token
  api_key_wo_version = 1

  extra_config = {
    tenantId = "dokploy"
  }
}

# Datadog for the logs and the host metrics.
resource "dokploy_telemetry_provider" "datadog" {
  name          = "datadog"
  provider_type = "datadog"
  signals       = ["logs", "metrics"]
  api_key_wo    = var.datadog_api_key

  extra_config = {
    site = "datadoghq.eu"
  }
}

# Start the Vector agent on the Dokploy host with both providers.
resource "dokploy_web_server_settings" "this" {
  telemetry_provider_ids = [
    dokploy_telemetry_provider.loki.id,
    dokploy_telemetry_provider.datadog.id,
  ]
}
```

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

### Required

- `name` (String) Display name. Dokploy does not enforce a unique name.
- `provider_type` (String) Destination type: `loki`, `datadog`, `betterstack`, `elasticsearch`, `splunk_hec`, `aws_cloudwatch`, `prometheus_remote_write`, `new_relic`, or `influxdb`.
- `signals` (Set of String) Data that the Vector agent sends: `logs`, `metrics`, or both. Dokploy rejects a signal that the type does not support, for example `metrics` for `loki`.

### Optional

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

- `api_key` (String, Sensitive) API key, token, or password of the destination. For `aws_cloudwatch`, the access key id. Dokploy does not return the value. Do not set it together with `api_key_wo`.
- `api_key_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Write-only form of `api_key`. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Do not set it together with `api_key`. The server does not return the value, so every update sends it. Change `api_key_wo_version` to start an update when only this value changed.
- `api_key_wo_version` (Number) Version of `api_key_wo`. Change it to start an update when only `api_key_wo` changed. It needs `api_key_wo`.
- `api_secret` (String, Sensitive) Second secret of the destination. Only `aws_cloudwatch` uses it, for the secret access key. Dokploy does not return the value. Do not set it together with `api_secret_wo`.
- `api_secret_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Write-only form of `api_secret`. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Do not set it together with `api_secret`. The server does not return the value, so every update sends it. Change `api_secret_wo_version` to start an update when only this value changed.
- `api_secret_wo_version` (Number) Version of `api_secret_wo`. Change it to start an update when only `api_secret_wo` changed. It needs `api_secret_wo`.
- `enabled` (Boolean) Whether the Vector agents send data to the destination. Defaults to `true`.
- `endpoint` (String) URL of the destination, for the types that need one, for example `https://logs.example.com/loki/api/v1/push`. Dokploy does not return the value, so the provider cannot detect a change made outside Terraform.
- `extra_config` (Map of String) Fields that only some types use, for example `region` and `logGroup` for `aws_cloudwatch`, `tenantId` and `username` for `loki`, or `org` and `bucket` for `influxdb`. The keys are the field names of the Dokploy UI form in camel case.

### Read-Only

- `created_at` (String) Creation timestamp from the server.
- `id` (String) Telemetry provider id.
- `organization_id` (String) Id of the organization that owns the provider.

## Import

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `id` attribute, for example:

```terraform
import {
  to = dokploy_telemetry_provider.loki
  id = "4CdmgsO7zpoBS4Vxm1IAP"
}
```

The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:

```shell
terraform import dokploy_telemetry_provider.loki 4CdmgsO7zpoBS4Vxm1IAP
```