1. Packages
  2. Mailgun Provider
  3. API Docs
  4. getDomain
Mailgun v3.5.9 published on Wednesday, Apr 9, 2025 by Pulumi

mailgun.getDomain

Explore with Pulumi AI

Mailgun v3.5.9 published on Wednesday, Apr 9, 2025 by Pulumi

mailgun.Domain provides details about a Mailgun domain.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as mailgun from "@pulumi/mailgun";

const domain = mailgun.getDomain({
    name: "test.example.com",
});
const mailgun_mx = new aws.index.Route53Record("mailgun-mx", {
    zoneId: zoneId,
    name: domainMailgun.name,
    type: "MX",
    ttl: 3600,
    records: [
        `${domain.receivingRecords?.[0]?.priority} ${domain.receivingRecords?.[0]?.value}.`,
        `${domain.receivingRecords?.[1]?.priority} ${domain.receivingRecords?.[1]?.value}.`,
    ],
});
Copy
import pulumi
import pulumi_aws as aws
import pulumi_mailgun as mailgun

domain = mailgun.get_domain(name="test.example.com")
mailgun_mx = aws.index.Route53Record("mailgun-mx",
    zone_id=zone_id,
    name=domain_mailgun.name,
    type=MX,
    ttl=3600,
    records=[
        f{domain.receiving_records[0].priority} {domain.receiving_records[0].value}.,
        f{domain.receiving_records[1].priority} {domain.receiving_records[1].value}.,
    ])
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws"
	"github.com/pulumi/pulumi-mailgun/sdk/v3/go/mailgun"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		domain, err := mailgun.LookupDomain(ctx, &mailgun.LookupDomainArgs{
			Name: "test.example.com",
		}, nil)
		if err != nil {
			return err
		}
		_, err = aws.NewRoute53Record(ctx, "mailgun-mx", &aws.Route53RecordArgs{
			ZoneId: zoneId,
			Name:   domainMailgun.Name,
			Type:   "MX",
			Ttl:    3600,
			Records: []string{
				fmt.Sprintf("%v %v.", domain.ReceivingRecords[0].Priority, domain.ReceivingRecords[0].Value),
				fmt.Sprintf("%v %v.", domain.ReceivingRecords[1].Priority, domain.ReceivingRecords[1].Value),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Mailgun = Pulumi.Mailgun;

return await Deployment.RunAsync(() => 
{
    var domain = Mailgun.GetDomain.Invoke(new()
    {
        Name = "test.example.com",
    });

    var mailgun_mx = new Aws.Index.Route53Record("mailgun-mx", new()
    {
        ZoneId = zoneId,
        Name = domainMailgun.Name,
        Type = "MX",
        Ttl = 3600,
        Records = new[]
        {
            $"{domain.Apply(getDomainResult => getDomainResult.ReceivingRecords[0]?.Priority)} {domain.Apply(getDomainResult => getDomainResult.ReceivingRecords[0]?.Value)}.",
            $"{domain.Apply(getDomainResult => getDomainResult.ReceivingRecords[1]?.Priority)} {domain.Apply(getDomainResult => getDomainResult.ReceivingRecords[1]?.Value)}.",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mailgun.MailgunFunctions;
import com.pulumi.mailgun.inputs.GetDomainArgs;
import com.pulumi.aws.route53Record;
import com.pulumi.aws.route53RecordArgs;
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) {
        final var domain = MailgunFunctions.getDomain(GetDomainArgs.builder()
            .name("test.example.com")
            .build());

        var mailgun_mx = new Route53Record("mailgun-mx", Route53RecordArgs.builder()
            .zoneId(zoneId)
            .name(domainMailgun.name())
            .type("MX")
            .ttl(3600)
            .records(List.of(            
                String.format("%s %s.", domain.receivingRecords()[0].priority(),domain.receivingRecords()[0].value()),
                String.format("%s %s.", domain.receivingRecords()[1].priority(),domain.receivingRecords()[1].value())))
            .build());

    }
}
Copy
resources:
  mailgun-mx:
    type: aws:route53Record
    properties:
      zoneId: ${zoneId}
      name: ${domainMailgun.name}
      type: MX
      ttl: 3600
      records:
        - ${domain.receivingRecords[0].priority} ${domain.receivingRecords[0].value}.
        - ${domain.receivingRecords[1].priority} ${domain.receivingRecords[1].value}.
variables:
  domain:
    fn::invoke:
      function: mailgun:getDomain
      arguments:
        name: test.example.com
Copy

Using getDomain

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getDomain(args: GetDomainArgs, opts?: InvokeOptions): Promise<GetDomainResult>
function getDomainOutput(args: GetDomainOutputArgs, opts?: InvokeOptions): Output<GetDomainResult>
Copy
def get_domain(click_tracking: Optional[bool] = None,
               dkim_key_size: Optional[int] = None,
               dkim_selector: Optional[str] = None,
               force_dkim_authority: Optional[bool] = None,
               name: Optional[str] = None,
               open_tracking: Optional[bool] = None,
               region: Optional[str] = None,
               smtp_password: Optional[str] = None,
               spam_action: Optional[str] = None,
               web_scheme: Optional[str] = None,
               wildcard: Optional[bool] = None,
               opts: Optional[InvokeOptions] = None) -> GetDomainResult
def get_domain_output(click_tracking: Optional[pulumi.Input[bool]] = None,
               dkim_key_size: Optional[pulumi.Input[int]] = None,
               dkim_selector: Optional[pulumi.Input[str]] = None,
               force_dkim_authority: Optional[pulumi.Input[bool]] = None,
               name: Optional[pulumi.Input[str]] = None,
               open_tracking: Optional[pulumi.Input[bool]] = None,
               region: Optional[pulumi.Input[str]] = None,
               smtp_password: Optional[pulumi.Input[str]] = None,
               spam_action: Optional[pulumi.Input[str]] = None,
               web_scheme: Optional[pulumi.Input[str]] = None,
               wildcard: Optional[pulumi.Input[bool]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetDomainResult]
Copy
func LookupDomain(ctx *Context, args *LookupDomainArgs, opts ...InvokeOption) (*LookupDomainResult, error)
func LookupDomainOutput(ctx *Context, args *LookupDomainOutputArgs, opts ...InvokeOption) LookupDomainResultOutput
Copy

> Note: This function is named LookupDomain in the Go SDK.

public static class GetDomain 
{
    public static Task<GetDomainResult> InvokeAsync(GetDomainArgs args, InvokeOptions? opts = null)
    public static Output<GetDomainResult> Invoke(GetDomainInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDomainResult> getDomain(GetDomainArgs args, InvokeOptions options)
public static Output<GetDomainResult> getDomain(GetDomainArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: mailgun:index/getDomain:getDomain
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name
This property is required.
Changes to this property will trigger replacement.
string
The name of the domain.
ClickTracking bool
The click tracking setting.
DkimKeySize Changes to this property will trigger replacement. int
DkimSelector Changes to this property will trigger replacement. string
ForceDkimAuthority Changes to this property will trigger replacement. bool
OpenTracking bool
The open tracking setting.
Region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
SmtpPassword string
The password to the SMTP server.
SpamAction Changes to this property will trigger replacement. string
The spam filtering setting.
WebScheme string
The tracking web scheme.
Wildcard Changes to this property will trigger replacement. bool
Whether or not the domain will accept email for sub-domains.
Name
This property is required.
Changes to this property will trigger replacement.
string
The name of the domain.
ClickTracking bool
The click tracking setting.
DkimKeySize Changes to this property will trigger replacement. int
DkimSelector Changes to this property will trigger replacement. string
ForceDkimAuthority Changes to this property will trigger replacement. bool
OpenTracking bool
The open tracking setting.
Region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
SmtpPassword string
The password to the SMTP server.
SpamAction Changes to this property will trigger replacement. string
The spam filtering setting.
WebScheme string
The tracking web scheme.
Wildcard Changes to this property will trigger replacement. bool
Whether or not the domain will accept email for sub-domains.
name
This property is required.
Changes to this property will trigger replacement.
String
The name of the domain.
clickTracking Boolean
The click tracking setting.
dkimKeySize Changes to this property will trigger replacement. Integer
dkimSelector Changes to this property will trigger replacement. String
forceDkimAuthority Changes to this property will trigger replacement. Boolean
openTracking Boolean
The open tracking setting.
region Changes to this property will trigger replacement. String
The region where domain will be created. Default value is us.
smtpPassword String
The password to the SMTP server.
spamAction Changes to this property will trigger replacement. String
The spam filtering setting.
webScheme String
The tracking web scheme.
wildcard Changes to this property will trigger replacement. Boolean
Whether or not the domain will accept email for sub-domains.
name
This property is required.
Changes to this property will trigger replacement.
string
The name of the domain.
clickTracking boolean
The click tracking setting.
dkimKeySize Changes to this property will trigger replacement. number
dkimSelector Changes to this property will trigger replacement. string
forceDkimAuthority Changes to this property will trigger replacement. boolean
openTracking boolean
The open tracking setting.
region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
smtpPassword string
The password to the SMTP server.
spamAction Changes to this property will trigger replacement. string
The spam filtering setting.
webScheme string
The tracking web scheme.
wildcard Changes to this property will trigger replacement. boolean
Whether or not the domain will accept email for sub-domains.
name
This property is required.
Changes to this property will trigger replacement.
str
The name of the domain.
click_tracking bool
The click tracking setting.
dkim_key_size Changes to this property will trigger replacement. int
dkim_selector Changes to this property will trigger replacement. str
force_dkim_authority Changes to this property will trigger replacement. bool
open_tracking bool
The open tracking setting.
region Changes to this property will trigger replacement. str
The region where domain will be created. Default value is us.
smtp_password str
The password to the SMTP server.
spam_action Changes to this property will trigger replacement. str
The spam filtering setting.
web_scheme str
The tracking web scheme.
wildcard Changes to this property will trigger replacement. bool
Whether or not the domain will accept email for sub-domains.
name
This property is required.
Changes to this property will trigger replacement.
String
The name of the domain.
clickTracking Boolean
The click tracking setting.
dkimKeySize Changes to this property will trigger replacement. Number
dkimSelector Changes to this property will trigger replacement. String
forceDkimAuthority Changes to this property will trigger replacement. Boolean
openTracking Boolean
The open tracking setting.
region Changes to this property will trigger replacement. String
The region where domain will be created. Default value is us.
smtpPassword String
The password to the SMTP server.
spamAction Changes to this property will trigger replacement. String
The spam filtering setting.
webScheme String
The tracking web scheme.
wildcard Changes to this property will trigger replacement. Boolean
Whether or not the domain will accept email for sub-domains.

getDomain Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the record.
ReceivingRecords List<GetDomainReceivingRecord>
A list of DNS records for receiving validation.

Deprecated: Use receiving_records_set instead.

ReceivingRecordsSets List<GetDomainReceivingRecordsSet>
SendingRecords List<GetDomainSendingRecord>
A list of DNS records for sending validation.

Deprecated: Use sending_records_set instead.

SendingRecordsSets List<GetDomainSendingRecordsSet>
SmtpLogin string
The login email for the SMTP server.
ClickTracking bool
The click tracking setting.
DkimKeySize int
DkimSelector string
ForceDkimAuthority bool
OpenTracking bool
The open tracking setting.
Region string
SmtpPassword string
The password to the SMTP server.
SpamAction string
The spam filtering setting.
WebScheme string
The tracking web scheme.
Wildcard bool
Whether or not the domain will accept email for sub-domains.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the record.
ReceivingRecords []GetDomainReceivingRecord
A list of DNS records for receiving validation.

Deprecated: Use receiving_records_set instead.

ReceivingRecordsSets []GetDomainReceivingRecordsSet
SendingRecords []GetDomainSendingRecord
A list of DNS records for sending validation.

Deprecated: Use sending_records_set instead.

SendingRecordsSets []GetDomainSendingRecordsSet
SmtpLogin string
The login email for the SMTP server.
ClickTracking bool
The click tracking setting.
DkimKeySize int
DkimSelector string
ForceDkimAuthority bool
OpenTracking bool
The open tracking setting.
Region string
SmtpPassword string
The password to the SMTP server.
SpamAction string
The spam filtering setting.
WebScheme string
The tracking web scheme.
Wildcard bool
Whether or not the domain will accept email for sub-domains.
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the record.
receivingRecords List<GetDomainReceivingRecord>
A list of DNS records for receiving validation.

Deprecated: Use receiving_records_set instead.

receivingRecordsSets List<GetDomainReceivingRecordsSet>
sendingRecords List<GetDomainSendingRecord>
A list of DNS records for sending validation.

Deprecated: Use sending_records_set instead.

sendingRecordsSets List<GetDomainSendingRecordsSet>
smtpLogin String
The login email for the SMTP server.
clickTracking Boolean
The click tracking setting.
dkimKeySize Integer
dkimSelector String
forceDkimAuthority Boolean
openTracking Boolean
The open tracking setting.
region String
smtpPassword String
The password to the SMTP server.
spamAction String
The spam filtering setting.
webScheme String
The tracking web scheme.
wildcard Boolean
Whether or not the domain will accept email for sub-domains.
id string
The provider-assigned unique ID for this managed resource.
name string
The name of the record.
receivingRecords GetDomainReceivingRecord[]
A list of DNS records for receiving validation.

Deprecated: Use receiving_records_set instead.

receivingRecordsSets GetDomainReceivingRecordsSet[]
sendingRecords GetDomainSendingRecord[]
A list of DNS records for sending validation.

Deprecated: Use sending_records_set instead.

sendingRecordsSets GetDomainSendingRecordsSet[]
smtpLogin string
The login email for the SMTP server.
clickTracking boolean
The click tracking setting.
dkimKeySize number
dkimSelector string
forceDkimAuthority boolean
openTracking boolean
The open tracking setting.
region string
smtpPassword string
The password to the SMTP server.
spamAction string
The spam filtering setting.
webScheme string
The tracking web scheme.
wildcard boolean
Whether or not the domain will accept email for sub-domains.
id str
The provider-assigned unique ID for this managed resource.
name str
The name of the record.
receiving_records Sequence[GetDomainReceivingRecord]
A list of DNS records for receiving validation.

Deprecated: Use receiving_records_set instead.

receiving_records_sets Sequence[GetDomainReceivingRecordsSet]
sending_records Sequence[GetDomainSendingRecord]
A list of DNS records for sending validation.

Deprecated: Use sending_records_set instead.

sending_records_sets Sequence[GetDomainSendingRecordsSet]
smtp_login str
The login email for the SMTP server.
click_tracking bool
The click tracking setting.
dkim_key_size int
dkim_selector str
force_dkim_authority bool
open_tracking bool
The open tracking setting.
region str
smtp_password str
The password to the SMTP server.
spam_action str
The spam filtering setting.
web_scheme str
The tracking web scheme.
wildcard bool
Whether or not the domain will accept email for sub-domains.
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the record.
receivingRecords List<Property Map>
A list of DNS records for receiving validation.

Deprecated: Use receiving_records_set instead.

receivingRecordsSets List<Property Map>
sendingRecords List<Property Map>
A list of DNS records for sending validation.

Deprecated: Use sending_records_set instead.

sendingRecordsSets List<Property Map>
smtpLogin String
The login email for the SMTP server.
clickTracking Boolean
The click tracking setting.
dkimKeySize Number
dkimSelector String
forceDkimAuthority Boolean
openTracking Boolean
The open tracking setting.
region String
smtpPassword String
The password to the SMTP server.
spamAction String
The spam filtering setting.
webScheme String
The tracking web scheme.
wildcard Boolean
Whether or not the domain will accept email for sub-domains.

Supporting Types

GetDomainReceivingRecord

Id This property is required. string
Priority This property is required. string
The priority of the record.
RecordType This property is required. string
The record type.
Valid This property is required. string
"valid" if the record is valid.
Value This property is required. string
The value of the record.
Id This property is required. string
Priority This property is required. string
The priority of the record.
RecordType This property is required. string
The record type.
Valid This property is required. string
"valid" if the record is valid.
Value This property is required. string
The value of the record.
id This property is required. String
priority This property is required. String
The priority of the record.
recordType This property is required. String
The record type.
valid This property is required. String
"valid" if the record is valid.
value This property is required. String
The value of the record.
id This property is required. string
priority This property is required. string
The priority of the record.
recordType This property is required. string
The record type.
valid This property is required. string
"valid" if the record is valid.
value This property is required. string
The value of the record.
id This property is required. str
priority This property is required. str
The priority of the record.
record_type This property is required. str
The record type.
valid This property is required. str
"valid" if the record is valid.
value This property is required. str
The value of the record.
id This property is required. String
priority This property is required. String
The priority of the record.
recordType This property is required. String
The record type.
valid This property is required. String
"valid" if the record is valid.
value This property is required. String
The value of the record.

GetDomainReceivingRecordsSet

Id This property is required. string
Priority This property is required. string
The priority of the record.
RecordType This property is required. string
The record type.
Valid This property is required. string
"valid" if the record is valid.
Value This property is required. string
The value of the record.
Id This property is required. string
Priority This property is required. string
The priority of the record.
RecordType This property is required. string
The record type.
Valid This property is required. string
"valid" if the record is valid.
Value This property is required. string
The value of the record.
id This property is required. String
priority This property is required. String
The priority of the record.
recordType This property is required. String
The record type.
valid This property is required. String
"valid" if the record is valid.
value This property is required. String
The value of the record.
id This property is required. string
priority This property is required. string
The priority of the record.
recordType This property is required. string
The record type.
valid This property is required. string
"valid" if the record is valid.
value This property is required. string
The value of the record.
id This property is required. str
priority This property is required. str
The priority of the record.
record_type This property is required. str
The record type.
valid This property is required. str
"valid" if the record is valid.
value This property is required. str
The value of the record.
id This property is required. String
priority This property is required. String
The priority of the record.
recordType This property is required. String
The record type.
valid This property is required. String
"valid" if the record is valid.
value This property is required. String
The value of the record.

GetDomainSendingRecord

Id This property is required. string
Name This property is required. string
The name of the domain.
RecordType This property is required. string
The record type.
Valid This property is required. string
"valid" if the record is valid.
Value This property is required. string
The value of the record.
Id This property is required. string
Name This property is required. string
The name of the domain.
RecordType This property is required. string
The record type.
Valid This property is required. string
"valid" if the record is valid.
Value This property is required. string
The value of the record.
id This property is required. String
name This property is required. String
The name of the domain.
recordType This property is required. String
The record type.
valid This property is required. String
"valid" if the record is valid.
value This property is required. String
The value of the record.
id This property is required. string
name This property is required. string
The name of the domain.
recordType This property is required. string
The record type.
valid This property is required. string
"valid" if the record is valid.
value This property is required. string
The value of the record.
id This property is required. str
name This property is required. str
The name of the domain.
record_type This property is required. str
The record type.
valid This property is required. str
"valid" if the record is valid.
value This property is required. str
The value of the record.
id This property is required. String
name This property is required. String
The name of the domain.
recordType This property is required. String
The record type.
valid This property is required. String
"valid" if the record is valid.
value This property is required. String
The value of the record.

GetDomainSendingRecordsSet

Id This property is required. string
Name This property is required. string
The name of the domain.
RecordType This property is required. string
The record type.
Valid This property is required. string
"valid" if the record is valid.
Value This property is required. string
The value of the record.
Id This property is required. string
Name This property is required. string
The name of the domain.
RecordType This property is required. string
The record type.
Valid This property is required. string
"valid" if the record is valid.
Value This property is required. string
The value of the record.
id This property is required. String
name This property is required. String
The name of the domain.
recordType This property is required. String
The record type.
valid This property is required. String
"valid" if the record is valid.
value This property is required. String
The value of the record.
id This property is required. string
name This property is required. string
The name of the domain.
recordType This property is required. string
The record type.
valid This property is required. string
"valid" if the record is valid.
value This property is required. string
The value of the record.
id This property is required. str
name This property is required. str
The name of the domain.
record_type This property is required. str
The record type.
valid This property is required. str
"valid" if the record is valid.
value This property is required. str
The value of the record.
id This property is required. String
name This property is required. String
The name of the domain.
recordType This property is required. String
The record type.
valid This property is required. String
"valid" if the record is valid.
value This property is required. String
The value of the record.

Package Details

Repository
Mailgun pulumi/pulumi-mailgun
License
Apache-2.0
Notes
This Pulumi package is based on the mailgun Terraform Provider.
Mailgun v3.5.9 published on Wednesday, Apr 9, 2025 by Pulumi