# dokploy_redirect (Resource)

A Traefik regex redirect on a Dokploy application.

~> Redirects are not unique. Dokploy allows two identical redirects on one application, and `redirects.create` does not return the record it made, so this provider identifies a newly created redirect by diffing the application's redirect list around the call. Creating redirects through the Dokploy UI while an apply is running can make that ambiguous, and the provider errors rather than guessing.

## Example Usage

```terraform
resource "dokploy_redirect" "legacy_blog" {
  application_id = dokploy_application.web.id
  regex          = "^/blog/(.*)"
  replacement    = "/posts/$1"
  permanent      = true
}
```

<!-- 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.
- `regex` (String) Path regex to match, e.g. `^/old/(.*)`.
- `replacement` (String) Replacement path, e.g. `/new/$1`.

### Optional

- `permanent` (Boolean) Issue a permanent (308) redirect rather than a temporary (307) one.

### 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_redirect.legacy_blog r1a2b3c4d5e6f7g8h9i0j
```