Use this data source to get DNS MX records for a domain.
# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
from constructs import Construct
from cdktf import TerraformOutput, Fn, TerraformStack
#
# Provider bindings are generated by running `cdktf get`.
# See https://cdk.tf/provider-generation for more details.
#
from imports.dns.data_dns_mx_record_set import DataDnsMxRecordSet
class MyConvertedCode(TerraformStack):
def __init__(self, scope, name):
super().__init__(scope, name)
mail = DataDnsMxRecordSet(self, "mail",
domain="example.com."
)
TerraformOutput(self, "mailserver",
value=Fn.lookup_nested(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)