# dokploy_port (Data Source)

Looks up a published port of an application that already exists in Dokploy:

```terraform
data "dokploy_port" "web" {
  application_id = data.dokploy_application.web.id
  published_port = 8080
}
```

~> Dokploy does not enforce uniqueness for this record. If two port records match the lookup attributes, this data source fails instead of a guess. Look the record up by `id` in that case.

## Example Usage

```terraform
data "dokploy_port" "example" {
  id = "your-port-id"
}

data "dokploy_port" "web" {
  application_id = data.dokploy_application.web.id
  published_port = 8080
}
```

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

### Optional

- `application_id` (String) Id of the application that owns the port. Set it with `published_port`.
- `id` (String) Port id. Set it for a lookup by id, or leave it unset and set `application_id` with the distinguishing attributes.
- `published_port` (Number) Port that the application publishes on the host.

### Read-Only

- `protocol` (String) Transport protocol: `tcp` or `udp`.
- `publish_mode` (String) Swarm publish mode: `host` or `ingress`.
- `target_port` (Number) Port that the container listens on.