---
title: "infoblox_mx_record Resource"
canonical: "https://docs.infoblox.com/space/ipamdriverterraform/216268976/infoblox_mx_record%20Resource"
format: markdown
---
The `infoblox_mx_record` resource corresponds to an MX record (mail exchanger record) in NIOS. An MX-record associates a mail exchange host to a domain name. For more information about an MX record, refer to *Managing MX Records* in the *[Infoblox NIOS Documentation](https://docs.infoblox.com/)*.

The following table describes the parameters you can define in the resource block of the record:

| **Parameter** | **Required/**  
**Optional** | **Description** | **Example Value** |
| --- | --- | --- | --- |
| `fqdn` | Required | Specifies the fully qualified domain name of the DNS zone to which a mail exchange host is assigned. | `big-big-company.com` |
| `mail_exchanger` | Required | Specifies the mail exchange host's fully qualified domain name. | `mx1.secure-mail-provider.net` |
| `preference` | Required | Specifies the preference number in the range of 0-65535, for the MX record. | `60` |
| `dns_view` | Optional | Specifies the DNS view in which the zone’s record exists.  
If a value is not specified, `default` will be used as the DNS view name. | `dns_view_1` |
| `ttl` | Optional | Specifies the Time to Live value for the record. There is no default value for this parameter.  
If a value is not specified, then in NIOS, the TTL value is inherited from the parent zone of the DNS record for this resource. A TTL value of 0 (zero) means caching should be disabled for this record. | `600` |
| `comment` | Optional | Describes the record. | `static record #1` |
| `ext_attrs` | Optional | Specifies the set of NIOS extensible attributes that are attached to the record. | `jsonencode({})` |

## Examples of the MX Record Block

`// MX-record, minimal set of parameters`  
`resource "infoblox_mx_record" "rec1" {`  
`  fqdn = "big-big-company.com"`  
`  mail_exchanger = "mx1.secure-mail-provider.net"`  
`  preference = 30`  
`}`  


`// MX-record, full set of parameters`  
`resource "infoblox_mx_record" "rec2" {`  
`  dns_view = "nondefault_dnsview1"`  
`  fqdn = "`example2.org` "`  
`  mail_exchanger = "sample.test.com"`  
`  preference = 40`  
`  comment = "example MX-record"`  
`  ttl = 120`  
`  ext_attrs = jsonencode({`  
`    "Location" = "Las Vegas"`  
`  })`  
`}`