# dokploy_certificate (Data Source)

Looks up a TLS certificate that already exists in Dokploy (Settings > Certificates), so that a domain with `certificate_type = "custom"` can reference it:

```terraform
data "dokploy_certificate" "wildcard" {
  name = "wildcard-example-com"
}
```

~> **The data source does not expose the private key.** `private_key` exists on the `dokploy_certificate` resource, but not here, by design. A consumer needs only the id.

~> Dokploy does not enforce name uniqueness. If two certificates share a name, this data source fails instead of a guess. Look the record up by `id` in that case.

## Example Usage

```terraform
data "dokploy_certificate" "example" {
  id = "your-certificate-id"
}

data "dokploy_certificate" "wildcard" {
  name = "wildcard-example-com"
}

# A domain that serves the uploaded certificate.
resource "dokploy_domain" "app" {
  host                 = "app.example.com"
  application_id       = dokploy_application.app.id
  https                = true
  certificate_type     = "custom"
  custom_cert_resolver = data.dokploy_certificate.wildcard.name
}
```

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

### Optional

- `id` (String) Certificate id. Set it for a lookup by id, or leave it unset and set `name`.
- `name` (String) Display name as shown in Dokploy. Set exactly one of `id` or `name`.

### Read-Only

- `auto_renew` (Boolean) Whether Dokploy renews the certificate.
- `certificate_data` (String) The certificate chain in PEM format.
- `certificate_path` (String) Name of the Traefik certificate file that Dokploy generates.
- `organization_id` (String) Id of the organization that owns the certificate.
- `server_id` (String) Id of the server that serves the certificate, or null for the Dokploy host.