---
title: "uptimeify_dns_monitor"
description: "Ressource uptimeify_dns_monitor: Beispiel, alle Attribute, Import."
---

<Callout>Die Beschreibungen auf dieser Seite kommen direkt aus dem Provider-Schema und sind deshalb englisch.</Callout>

A DNS monitor: resolves `hostname` and compares the answers per record type with `expected_values`. Import with the numeric id or the public id.

## Beispiel

```terraform
data "uptimeify_customer" "shop" {
  name = "Example Shop GmbH"
}

resource "uptimeify_dns_monitor" "this" {
  customer_id     = data.uptimeify_customer.shop.id
  name            = "shop.example MX"
  hostname        = "shop.example"
  record_types    = ["A", "MX"]
  match_mode      = "contains"
  expected_values = {
    A  = ["203.0.113.10"]
    MX = ["10 mail.shop.example."]
  }
  allowed_check_country_codes = ["DE", "NL"]
}
```

## Schema

### Pflichtfelder

- `customer_id` (Number) Customer the monitor belongs to. Changing it moves the monitor to another customer of the same organization in place.
- `expected_values` (Map of List of String) Expected answers per record type (upper-case key); every type in `record_types` needs at least one value. Values unique and without surrounding spaces.
- `hostname` (String) Host name or IP address only: no scheme, no path, no spaces.
- `match_mode` (String) `exact` (answer set equals the expected values) or `contains` (answer includes them).
- `name` (String) Display name, 1 to 255 characters.
- `record_types` (List of String) Record types to resolve, upper case and unique, e.g. `["A", "MX"]`.

### Optional

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

- `allow_duplicate` (Boolean, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Create the monitor even if the customer already has one of this type for the same target. Without it the create fails with 409 `monitorAlreadyExists` and the error names the import command for the existing monitor. Sent with create only.
- `allowed_check_country_codes` (Set of String) Upper-case ISO 3166-1 alpha-2 codes of the allowed check locations. Unset = all locations.
- `check_interval` (Number) Minutes between checks, 1 to 1440. Defaults to 30. The customer's package can require a larger minimum.
- `management_type` (String) `managed` or `self_service`. Only organization writers choose it; customer tokens always get `self_service`. Defaults to `managed`.
- `require_expected_values` (Boolean) Defaults to false.
- `status` (String) `active`, `maintenance` or `disabled`. Defaults to `active`.
- `timeout_seconds` (Number) Timeout per check in seconds, 1 to 60. Defaults to 30.
- `trigger_on_mismatch` (Boolean) Alert when the answers do not match. Defaults to true.
- `trigger_on_resolve_error` (Boolean) Alert when the name does not resolve. Defaults to true.

### Nur lesbar

- `created_at` (String)
- `id` (String) Numeric DNS monitor id.
- `organization_id` (Number)
- `public_id` (String) Public UUID of the DNS monitor.
- `updated_at` (String)

## Import

Import geht so:

Mit [`tofu import` bzw. `terraform import`](https://developer.hashicorp.com/terraform/cli/commands/import), zum Beispiel:

```shell
# Numeric id or public id
terraform import uptimeify_dns_monitor.this 42
```
