getDomain

mailgun.Domain provides details about a Mailgun domain.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;
using Mailgun = Pulumi.Mailgun;

class MyStack : Stack
{
    public MyStack()
    {
        var domain = Output.Create(Mailgun.GetDomain.InvokeAsync(new Mailgun.GetDomainArgs
        {
            Name = "test.example.com",
        }));
        var mailgun_mx = new Aws.Route53.Record("mailgun-mx", new Aws.Route53.RecordArgs
        {
            Name = data.Mailgun.Domain.Name,
            Records = 
            {
                Output.Tuple(domain, domain).Apply(values =>
                {
                    var domain = values.Item1;
                    var domain1 = values.Item2;
                    return $"{domain.ReceivingRecords[0].Priority} {domain1.ReceivingRecords[0].Value}.";
                }),
                Output.Tuple(domain, domain).Apply(values =>
                {
                    var domain = values.Item1;
                    var domain1 = values.Item2;
                    return $"{domain.ReceivingRecords[1].Priority} {domain1.ReceivingRecords[1].Value}.";
                }),
            },
            Ttl = 3600,
            Type = "MX",
            ZoneId = @var.Zone_id,
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/route53"
	"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 = route53.NewRecord(ctx, "mailgun_mx", &route53.RecordArgs{
			Name: pulumi.Any(data.Mailgun.Domain.Name),
			Records: pulumi.StringArray{
				pulumi.String(fmt.Sprintf("%v%v%v%v", domain.ReceivingRecords[0].Priority, " ", domain.ReceivingRecords[0].Value, ".")),
				pulumi.String(fmt.Sprintf("%v%v%v%v", domain.ReceivingRecords[1].Priority, " ", domain.ReceivingRecords[1].Value, ".")),
			},
			Ttl:    pulumi.Int(3600),
			Type:   pulumi.String("MX"),
			ZoneId: pulumi.Any(_var.Zone_id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws
import pulumi_mailgun as mailgun

domain = mailgun.get_domain(name="test.example.com")
mailgun_mx = aws.route53.Record("mailgun-mx",
    name=data["mailgun"]["domain"]["name"],
    records=[
        f"{domain.receiving_records[0].priority} {domain.receiving_records[0].value}.",
        f"{domain.receiving_records[1].priority} {domain.receiving_records[1].value}.",
    ],
    ttl=3600,
    type="MX",
    zone_id=var["zone_id"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as mailgun from "@pulumi/mailgun";

const domain = pulumi.output(mailgun.getDomain({
    name: "test.example.com",
}, { async: true }));
const mailgun_mx = new aws.route53.Record("mailgun-mx", {
    name: mailgun_domain.name,
    records: [
        pulumi.interpolate`${domain.receivingRecords[0].priority} ${domain.receivingRecords[0].value}.`,
        pulumi.interpolate`${domain.receivingRecords[1].priority} ${domain.receivingRecords[1].value}.`,
    ],
    ttl: 3600,
    type: "MX",
    zoneId: var_zone_id,
});

Using getDomain

function getDomain(args: GetDomainArgs, opts?: InvokeOptions): Promise<GetDomainResult>
def get_domain(dkim_key_size: Optional[int] = None,
               dkim_selector: Optional[str] = None,
               name: Optional[str] = None,
               region: Optional[str] = None,
               smtp_password: Optional[str] = None,
               spam_action: Optional[str] = None,
               wildcard: Optional[bool] = None,
               opts: Optional[InvokeOptions] = None) -> GetDomainResult
func LookupDomain(ctx *Context, args *LookupDomainArgs, opts ...InvokeOption) (*LookupDomainResult, error)

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

public static class GetDomain {
    public static Task<GetDomainResult> InvokeAsync(GetDomainArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string
The name of the domain.
DkimKeySize int
DkimSelector string
Region string
SmtpPassword string
The password to the SMTP server.
SpamAction string
The spam filtering setting.
Wildcard bool
Whether or not the domain will accept email for sub-domains.
Name string
The name of the domain.
DkimKeySize int
DkimSelector string
Region string
SmtpPassword string
The password to the SMTP server.
SpamAction string
The spam filtering setting.
Wildcard bool
Whether or not the domain will accept email for sub-domains.
name string
The name of the domain.
dkimKeySize number
dkimSelector string
region string
smtpPassword string
The password to the SMTP server.
spamAction string
The spam filtering setting.
wildcard boolean
Whether or not the domain will accept email for sub-domains.
name str
The name of the domain.
dkim_key_size int
dkim_selector str
region str
smtp_password str
The password to the SMTP server.
spam_action str
The spam filtering setting.
wildcard bool
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.
SendingRecords List<GetDomainSendingRecord>
A list of DNS records for sending validation.
SmtpLogin string
The login email for the SMTP server.
SmtpPassword string
The password to the SMTP server.
DkimKeySize int
DkimSelector string
Region string
SpamAction string
The spam filtering setting.
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.
SendingRecords []GetDomainSendingRecord
A list of DNS records for sending validation.
SmtpLogin string
The login email for the SMTP server.
SmtpPassword string
The password to the SMTP server.
DkimKeySize int
DkimSelector string
Region string
SpamAction string
The spam filtering setting.
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.
sendingRecords GetDomainSendingRecord[]
A list of DNS records for sending validation.
smtpLogin string
The login email for the SMTP server.
smtpPassword string
The password to the SMTP server.
dkimKeySize number
dkimSelector string
region string
spamAction string
The spam filtering setting.
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.
sending_records Sequence[GetDomainSendingRecord]
A list of DNS records for sending validation.
smtp_login str
The login email for the SMTP server.
smtp_password str
The password to the SMTP server.
dkim_key_size int
dkim_selector str
region str
spam_action str
The spam filtering setting.
wildcard bool
Whether or not the domain will accept email for sub-domains.

Supporting Types

GetDomainReceivingRecord

Priority string
The priority of the record.
RecordType string
The record type.
Valid string
"valid" if the record is valid.
Value string
The value of the record.
Priority string
The priority of the record.
RecordType string
The record type.
Valid string
"valid" if the record is valid.
Value string
The value of the record.
priority string
The priority of the record.
recordType string
The record type.
valid string
"valid" if the record is valid.
value string
The value of the record.
priority str
The priority of the record.
record_type str
The record type.
valid str
"valid" if the record is valid.
value str
The value of the record.

GetDomainSendingRecord

Name string
The name of the domain.
RecordType string
The record type.
Valid string
"valid" if the record is valid.
Value string
The value of the record.
Name string
The name of the domain.
RecordType string
The record type.
Valid string
"valid" if the record is valid.
Value string
The value of the record.
name string
The name of the domain.
recordType string
The record type.
valid string
"valid" if the record is valid.
value string
The value of the record.
name str
The name of the domain.
record_type str
The record type.
valid str
"valid" if the record is valid.
value str
The value of the record.

Package Details

Repository
https://github.com/pulumi/pulumi-mailgun
License
Apache-2.0
Notes
This Pulumi package is based on the mailgun Terraform Provider.