1. Packages
  2. Infoblox Provider
  3. API Docs
  4. MxRecord
infoblox 2.9.0 published on Monday, Apr 14, 2025 by infobloxopen

infoblox.MxRecord

Explore with Pulumi AI

# MX-record Resource

The infoblox.MxRecord resource corresponds to MX-record (mail exchanger record) on NIOS side, and it associates a mail exchange host to a domain name.

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

  • fqdn: required, specifies the fully qualified domain name which you want to assign a mail exchange host for. Example: big-big-company.com
  • mail_exchanger: required, specifies the mail exchange host’s fully qualified domain name. Example: mx1.secure-mail-provider.net
  • preference: required, specifies the preference number (0-65535) for this MX-record.
  • dns_view: optional, specifies the DNS view which the zone exists in. If a value is not specified, the name default is used for DNS view. Example: 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 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. Example: 600
  • comment: optional, describes the record. Example: auto-created test record #1
  • ext_attrs: optional, a set of NIOS extensible attributes that are attached to the record. Example: jsonencode({})

Examples

import * as pulumi from "@pulumi/pulumi";
import * as infoblox from "@pulumi/infoblox";

// MX-record, minimal set of parameters
const rec1 = new infoblox.MxRecord("rec1", {
    fqdn: "big-big-company.com",
    mailExchanger: "mx1.secure-mail-provider.net",
    preference: 30,
});
// MX-record, full set of parameters
const rec2 = new infoblox.MxRecord("rec2", {
    dnsView: "nondefault_dnsview1",
    fqdn: "rec2.example2.org",
    mailExchanger: "sample.test.com",
    preference: 40,
    comment: "example MX-record",
    ttl: 120,
    extAttrs: JSON.stringify({
        Location: "Las Vegas",
    }),
});
Copy
import pulumi
import json
import pulumi_infoblox as infoblox

# MX-record, minimal set of parameters
rec1 = infoblox.MxRecord("rec1",
    fqdn="big-big-company.com",
    mail_exchanger="mx1.secure-mail-provider.net",
    preference=30)
# MX-record, full set of parameters
rec2 = infoblox.MxRecord("rec2",
    dns_view="nondefault_dnsview1",
    fqdn="rec2.example2.org",
    mail_exchanger="sample.test.com",
    preference=40,
    comment="example MX-record",
    ttl=120,
    ext_attrs=json.dumps({
        "Location": "Las Vegas",
    }))
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-terraform-provider/sdks/go/infoblox/v2/infoblox"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// MX-record, minimal set of parameters
		_, err := infoblox.NewMxRecord(ctx, "rec1", &infoblox.MxRecordArgs{
			Fqdn:          pulumi.String("big-big-company.com"),
			MailExchanger: pulumi.String("mx1.secure-mail-provider.net"),
			Preference:    pulumi.Float64(30),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Location": "Las Vegas",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		// MX-record, full set of parameters
		_, err = infoblox.NewMxRecord(ctx, "rec2", &infoblox.MxRecordArgs{
			DnsView:       pulumi.String("nondefault_dnsview1"),
			Fqdn:          pulumi.String("rec2.example2.org"),
			MailExchanger: pulumi.String("sample.test.com"),
			Preference:    pulumi.Float64(40),
			Comment:       pulumi.String("example MX-record"),
			Ttl:           pulumi.Float64(120),
			ExtAttrs:      pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Infoblox = Pulumi.Infoblox;

return await Deployment.RunAsync(() => 
{
    // MX-record, minimal set of parameters
    var rec1 = new Infoblox.MxRecord("rec1", new()
    {
        Fqdn = "big-big-company.com",
        MailExchanger = "mx1.secure-mail-provider.net",
        Preference = 30,
    });

    // MX-record, full set of parameters
    var rec2 = new Infoblox.MxRecord("rec2", new()
    {
        DnsView = "nondefault_dnsview1",
        Fqdn = "rec2.example2.org",
        MailExchanger = "sample.test.com",
        Preference = 40,
        Comment = "example MX-record",
        Ttl = 120,
        ExtAttrs = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Location"] = "Las Vegas",
        }),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.infoblox.MxRecord;
import com.pulumi.infoblox.MxRecordArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        // MX-record, minimal set of parameters
        var rec1 = new MxRecord("rec1", MxRecordArgs.builder()
            .fqdn("big-big-company.com")
            .mailExchanger("mx1.secure-mail-provider.net")
            .preference(30)
            .build());

        // MX-record, full set of parameters
        var rec2 = new MxRecord("rec2", MxRecordArgs.builder()
            .dnsView("nondefault_dnsview1")
            .fqdn("rec2.example2.org")
            .mailExchanger("sample.test.com")
            .preference(40)
            .comment("example MX-record")
            .ttl(120)
            .extAttrs(serializeJson(
                jsonObject(
                    jsonProperty("Location", "Las Vegas")
                )))
            .build());

    }
}
Copy
resources:
  # MX-record, minimal set of parameters
  rec1:
    type: infoblox:MxRecord
    properties:
      fqdn: big-big-company.com
      mailExchanger: mx1.secure-mail-provider.net
      preference: 30
  # MX-record, full set of parameters
  rec2:
    type: infoblox:MxRecord
    properties:
      dnsView: nondefault_dnsview1
      fqdn: rec2.example2.org
      mailExchanger: sample.test.com
      preference: 40
      comment: example MX-record
      ttl: 120
      extAttrs:
        fn::toJSON:
          Location: Las Vegas
Copy

Create MxRecord Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new MxRecord(name: string, args: MxRecordArgs, opts?: CustomResourceOptions);
@overload
def MxRecord(resource_name: str,
             args: MxRecordArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def MxRecord(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             fqdn: Optional[str] = None,
             mail_exchanger: Optional[str] = None,
             preference: Optional[float] = None,
             comment: Optional[str] = None,
             dns_view: Optional[str] = None,
             ext_attrs: Optional[str] = None,
             mx_record_id: Optional[str] = None,
             ttl: Optional[float] = None)
func NewMxRecord(ctx *Context, name string, args MxRecordArgs, opts ...ResourceOption) (*MxRecord, error)
public MxRecord(string name, MxRecordArgs args, CustomResourceOptions? opts = null)
public MxRecord(String name, MxRecordArgs args)
public MxRecord(String name, MxRecordArgs args, CustomResourceOptions options)
type: infoblox:MxRecord
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. MxRecordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. MxRecordArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. MxRecordArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. MxRecordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. MxRecordArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var mxRecordResource = new Infoblox.MxRecord("mxRecordResource", new()
{
    Fqdn = "string",
    MailExchanger = "string",
    Preference = 0,
    Comment = "string",
    DnsView = "string",
    ExtAttrs = "string",
    MxRecordId = "string",
    Ttl = 0,
});
Copy
example, err := infoblox.NewMxRecord(ctx, "mxRecordResource", &infoblox.MxRecordArgs{
Fqdn: pulumi.String("string"),
MailExchanger: pulumi.String("string"),
Preference: pulumi.Float64(0),
Comment: pulumi.String("string"),
DnsView: pulumi.String("string"),
ExtAttrs: pulumi.String("string"),
MxRecordId: pulumi.String("string"),
Ttl: pulumi.Float64(0),
})
Copy
var mxRecordResource = new MxRecord("mxRecordResource", MxRecordArgs.builder()
    .fqdn("string")
    .mailExchanger("string")
    .preference(0)
    .comment("string")
    .dnsView("string")
    .extAttrs("string")
    .mxRecordId("string")
    .ttl(0)
    .build());
Copy
mx_record_resource = infoblox.MxRecord("mxRecordResource",
    fqdn="string",
    mail_exchanger="string",
    preference=0,
    comment="string",
    dns_view="string",
    ext_attrs="string",
    mx_record_id="string",
    ttl=0)
Copy
const mxRecordResource = new infoblox.MxRecord("mxRecordResource", {
    fqdn: "string",
    mailExchanger: "string",
    preference: 0,
    comment: "string",
    dnsView: "string",
    extAttrs: "string",
    mxRecordId: "string",
    ttl: 0,
});
Copy
type: infoblox:MxRecord
properties:
    comment: string
    dnsView: string
    extAttrs: string
    fqdn: string
    mailExchanger: string
    mxRecordId: string
    preference: 0
    ttl: 0
Copy

MxRecord Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The MxRecord resource accepts the following input properties:

Fqdn This property is required. string
FQDN for the MX-record.
MailExchanger This property is required. string
A record used to specify mail server.
Preference This property is required. double
Configures the preference (0-65535) for this MX-record.
Comment string
Description of the MX-Record.
DnsView string
DNS view which the zone does exist within
ExtAttrs string
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
MxRecordId string
Ttl double
TTL value for the MX-record.
Fqdn This property is required. string
FQDN for the MX-record.
MailExchanger This property is required. string
A record used to specify mail server.
Preference This property is required. float64
Configures the preference (0-65535) for this MX-record.
Comment string
Description of the MX-Record.
DnsView string
DNS view which the zone does exist within
ExtAttrs string
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
MxRecordId string
Ttl float64
TTL value for the MX-record.
fqdn This property is required. String
FQDN for the MX-record.
mailExchanger This property is required. String
A record used to specify mail server.
preference This property is required. Double
Configures the preference (0-65535) for this MX-record.
comment String
Description of the MX-Record.
dnsView String
DNS view which the zone does exist within
extAttrs String
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
mxRecordId String
ttl Double
TTL value for the MX-record.
fqdn This property is required. string
FQDN for the MX-record.
mailExchanger This property is required. string
A record used to specify mail server.
preference This property is required. number
Configures the preference (0-65535) for this MX-record.
comment string
Description of the MX-Record.
dnsView string
DNS view which the zone does exist within
extAttrs string
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
mxRecordId string
ttl number
TTL value for the MX-record.
fqdn This property is required. str
FQDN for the MX-record.
mail_exchanger This property is required. str
A record used to specify mail server.
preference This property is required. float
Configures the preference (0-65535) for this MX-record.
comment str
Description of the MX-Record.
dns_view str
DNS view which the zone does exist within
ext_attrs str
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
mx_record_id str
ttl float
TTL value for the MX-record.
fqdn This property is required. String
FQDN for the MX-record.
mailExchanger This property is required. String
A record used to specify mail server.
preference This property is required. Number
Configures the preference (0-65535) for this MX-record.
comment String
Description of the MX-Record.
dnsView String
DNS view which the zone does exist within
extAttrs String
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
mxRecordId String
ttl Number
TTL value for the MX-record.

Outputs

All input properties are implicitly available as output properties. Additionally, the MxRecord resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
InternalId string
Ref string
NIOS object's reference, not to be set by a user.
Id string
The provider-assigned unique ID for this managed resource.
InternalId string
Ref string
NIOS object's reference, not to be set by a user.
id String
The provider-assigned unique ID for this managed resource.
internalId String
ref String
NIOS object's reference, not to be set by a user.
id string
The provider-assigned unique ID for this managed resource.
internalId string
ref string
NIOS object's reference, not to be set by a user.
id str
The provider-assigned unique ID for this managed resource.
internal_id str
ref str
NIOS object's reference, not to be set by a user.
id String
The provider-assigned unique ID for this managed resource.
internalId String
ref String
NIOS object's reference, not to be set by a user.

Look up Existing MxRecord Resource

Get an existing MxRecord resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MxRecordState, opts?: CustomResourceOptions): MxRecord
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        comment: Optional[str] = None,
        dns_view: Optional[str] = None,
        ext_attrs: Optional[str] = None,
        fqdn: Optional[str] = None,
        internal_id: Optional[str] = None,
        mail_exchanger: Optional[str] = None,
        mx_record_id: Optional[str] = None,
        preference: Optional[float] = None,
        ref: Optional[str] = None,
        ttl: Optional[float] = None) -> MxRecord
func GetMxRecord(ctx *Context, name string, id IDInput, state *MxRecordState, opts ...ResourceOption) (*MxRecord, error)
public static MxRecord Get(string name, Input<string> id, MxRecordState? state, CustomResourceOptions? opts = null)
public static MxRecord get(String name, Output<String> id, MxRecordState state, CustomResourceOptions options)
resources:  _:    type: infoblox:MxRecord    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Comment string
Description of the MX-Record.
DnsView string
DNS view which the zone does exist within
ExtAttrs string
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
Fqdn string
FQDN for the MX-record.
InternalId string
MailExchanger string
A record used to specify mail server.
MxRecordId string
Preference double
Configures the preference (0-65535) for this MX-record.
Ref string
NIOS object's reference, not to be set by a user.
Ttl double
TTL value for the MX-record.
Comment string
Description of the MX-Record.
DnsView string
DNS view which the zone does exist within
ExtAttrs string
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
Fqdn string
FQDN for the MX-record.
InternalId string
MailExchanger string
A record used to specify mail server.
MxRecordId string
Preference float64
Configures the preference (0-65535) for this MX-record.
Ref string
NIOS object's reference, not to be set by a user.
Ttl float64
TTL value for the MX-record.
comment String
Description of the MX-Record.
dnsView String
DNS view which the zone does exist within
extAttrs String
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
fqdn String
FQDN for the MX-record.
internalId String
mailExchanger String
A record used to specify mail server.
mxRecordId String
preference Double
Configures the preference (0-65535) for this MX-record.
ref String
NIOS object's reference, not to be set by a user.
ttl Double
TTL value for the MX-record.
comment string
Description of the MX-Record.
dnsView string
DNS view which the zone does exist within
extAttrs string
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
fqdn string
FQDN for the MX-record.
internalId string
mailExchanger string
A record used to specify mail server.
mxRecordId string
preference number
Configures the preference (0-65535) for this MX-record.
ref string
NIOS object's reference, not to be set by a user.
ttl number
TTL value for the MX-record.
comment str
Description of the MX-Record.
dns_view str
DNS view which the zone does exist within
ext_attrs str
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
fqdn str
FQDN for the MX-record.
internal_id str
mail_exchanger str
A record used to specify mail server.
mx_record_id str
preference float
Configures the preference (0-65535) for this MX-record.
ref str
NIOS object's reference, not to be set by a user.
ttl float
TTL value for the MX-record.
comment String
Description of the MX-Record.
dnsView String
DNS view which the zone does exist within
extAttrs String
Extensible attributes of the MX-record to be added/updated, as a map in JSON format.
fqdn String
FQDN for the MX-record.
internalId String
mailExchanger String
A record used to specify mail server.
mxRecordId String
preference Number
Configures the preference (0-65535) for this MX-record.
ref String
NIOS object's reference, not to be set by a user.
ttl Number
TTL value for the MX-record.

Package Details

Repository
infoblox infobloxopen/terraform-provider-infoblox
License
Notes
This Pulumi package is based on the infoblox Terraform Provider.