--- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "unifi_dns_record Resource - terraform-provider-unifi" subcategory: "" description: |- The unifi_dns_record resource manages DNS records in the UniFi controller's DNS server. This resource allows you to configure various types of DNS records for local name resolution. Common use cases include: Creating A records for local servers and devicesSetting up CNAME aliases for internal servicesConfiguring MX records for local mail serversAdding TXT records for service verification --- # unifi_dns_record (Resource) The `unifi_dns_record` resource manages DNS records in the UniFi controller's DNS server. This resource allows you to configure various types of DNS records for local name resolution. Common use cases include: * Creating A records for local servers and devices * Setting up CNAME aliases for internal services * Configuring MX records for local mail servers * Adding TXT records for service verification ## Example Usage ```terraform resource "unifi_dns_record" "a_record" { name = "example.mydomain.com" type = "A" record = "192.168.1.190" } resource "unifi_dns_record" "cname_record" { name = "example.mydomain.com" type = "CNAME" record = "example.com" } ``` ## Schema ### Required - `name` (String) DNS record name. - `record` (String) The content of the DNS record. The expected value depends on the record type: * For A records: IPv4 address (e.g., '192.168.1.10') * For AAAA records: IPv6 address * For CNAME records: Canonical name (e.g., 'server1.example.com') * For MX records: Mail server hostname * For TXT records: Text content (e.g., 'v=spf1 include:_spf.example.com ~all') - `type` (String) The type of DNS record. Valid values are: * `A` - Maps a hostname to IPv4 address * `AAAA` - Maps a hostname to IPv6 address * `CNAME` - Creates an alias for another domain name * `MX` - Specifies mail servers for the domain * `NS` - Delegates a subdomain to a set of name servers * `PTR` - Creates a pointer to a canonical name (reverse DNS) * `SOA` - Specifies authoritative information about the domain * `SRV` - Specifies location of services (hostname and port) * `TXT` - Holds descriptive text ### Optional - `enabled` (Boolean) Whether the DNS record is active. Defaults to true. Set to false to temporarily disable resolution without removing the record. - `port` (Number) The port number for SRV records. Valid values are between 1 and 65535. Only used with SRV records. - `priority` (Number) Priority value for MX and SRV records. Lower values indicate higher priority. Required for MX and SRV records, ignored for other types. - `site` (String) The name of the UniFi site where this resource should be applied. If not specified, the default site will be used. - `ttl` (Number) Time To Live (TTL) in seconds, determines how long DNS resolvers should cache this record. Set to 0 for automatic TTL. Common values: 300 (5 minutes), 3600 (1 hour), 86400 (1 day). - `weight` (Number) A relative weight for SRV records with the same priority. Higher values get proportionally more traffic. Only used with SRV records. ### Read-Only - `id` (String) The unique identifier of this resource.