# dokploy_port (Resource)

A published port on a Dokploy application, mapping a host port to a container port.

## Example Usage

```terraform
resource "dokploy_port" "metrics" {
  application_id = dokploy_application.web.id
  published_port = 9100
  target_port    = 9100
  protocol       = "tcp"
  publish_mode   = "host"
}
```

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

### Required

- `application_id` (String) Id of the application this belongs to. Changing it forces replacement: Dokploy's update endpoint for this record type takes no parent field, so a record cannot be moved between applications.
- `published_port` (Number) Port published on the host.
- `target_port` (Number) Port the container listens on.

### Optional

- `protocol` (String) Transport protocol: `tcp` or `udp`.
- `publish_mode` (String) Swarm publish mode: `host` or `ingress`.

### Read-Only

- `id` (String) Record 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_port.metrics p1a2b3c4d5e6f7g8h9i0j
```