Use this data source to get DNS MX records for a domain.
data "dns_mx_record_set" "mail" {
domain = "example.com."
}
output "mailserver" {
value = data.dns_mx_record_set.mail.mx.0.exchange
}
domain
(String) Domain to look up.id
(String) Always set to the domain.mx
(List of Object) A list of records. They are sorted by ascending preference then alphabetically by exchange to stay consistent across runs. (see below for nested schema)mx
Read-Only:
exchange
(String)preference
(Number)