Domain

Provides a Mailgun App resource. This can be used to create and manage applications on Mailgun.

After DNS records are set, domain verification should be triggered manually using PUT /domains/<domain>/verify

Example Usage

using Pulumi;
using Mailgun = Pulumi.Mailgun;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new Mailgun domain
        var @default = new Mailgun.Domain("default", new Mailgun.DomainArgs
        {
            DkimKeySize = 1024,
            Region = "us",
            SmtpPassword = "supersecretpassword1234",
            SpamAction = "disabled",
        });
    }

}
package main

import (
	"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 {
		_, err := mailgun.NewDomain(ctx, "_default", &mailgun.DomainArgs{
			DkimKeySize:  pulumi.Int(1024),
			Region:       pulumi.String("us"),
			SmtpPassword: pulumi.String("supersecretpassword1234"),
			SpamAction:   pulumi.String("disabled"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_mailgun as mailgun

# Create a new Mailgun domain
default = mailgun.Domain("default",
    dkim_key_size=1024,
    region="us",
    smtp_password="supersecretpassword1234",
    spam_action="disabled")
import * as pulumi from "@pulumi/pulumi";
import * as mailgun from "@pulumi/mailgun";

// Create a new Mailgun domain
const defaultDomain = new mailgun.Domain("default", {
    dkimKeySize: 1024,
    region: "us",
    smtpPassword: "supersecretpassword1234",
    spamAction: "disabled",
});

Create a Domain Resource

new Domain(name: string, args?: DomainArgs, opts?: CustomResourceOptions);
@overload
def Domain(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           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)
@overload
def Domain(resource_name: str,
           args: Optional[DomainArgs] = None,
           opts: Optional[ResourceOptions] = None)
func NewDomain(ctx *Context, name string, args *DomainArgs, opts ...ResourceOption) (*Domain, error)
public Domain(string name, DomainArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args DomainArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args DomainArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DomainArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DomainArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Domain Resource Properties

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

Inputs

The Domain resource accepts the following input properties:

DkimKeySize int
The length of your domain’s generated DKIM key. Default value is 1024.
DkimSelector string
The name of your DKIM selector if you want to specify it whereas MailGun will make it’s own choice.
Name string
The domain to add to Mailgun
Region string
The region where domain will be created. Default value is us.
SmtpPassword string
Password for SMTP authentication
SpamAction string
disabled or tag Disable, no spam filtering will occur for inbound messages. Tag, messages will be tagged with a spam header.
Wildcard bool
Boolean that determines whether the domain will accept email for sub-domains.
DkimKeySize int
The length of your domain’s generated DKIM key. Default value is 1024.
DkimSelector string
The name of your DKIM selector if you want to specify it whereas MailGun will make it’s own choice.
Name string
The domain to add to Mailgun
Region string
The region where domain will be created. Default value is us.
SmtpPassword string
Password for SMTP authentication
SpamAction string
disabled or tag Disable, no spam filtering will occur for inbound messages. Tag, messages will be tagged with a spam header.
Wildcard bool
Boolean that determines whether the domain will accept email for sub-domains.
dkimKeySize number
The length of your domain’s generated DKIM key. Default value is 1024.
dkimSelector string
The name of your DKIM selector if you want to specify it whereas MailGun will make it’s own choice.
name string
The domain to add to Mailgun
region string
The region where domain will be created. Default value is us.
smtpPassword string
Password for SMTP authentication
spamAction string
disabled or tag Disable, no spam filtering will occur for inbound messages. Tag, messages will be tagged with a spam header.
wildcard boolean
Boolean that determines whether the domain will accept email for sub-domains.
dkim_key_size int
The length of your domain’s generated DKIM key. Default value is 1024.
dkim_selector str
The name of your DKIM selector if you want to specify it whereas MailGun will make it’s own choice.
name str
The domain to add to Mailgun
region str
The region where domain will be created. Default value is us.
smtp_password str
Password for SMTP authentication
spam_action str
disabled or tag Disable, no spam filtering will occur for inbound messages. Tag, messages will be tagged with a spam header.
wildcard bool
Boolean that determines whether the domain will accept email for sub-domains.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
ReceivingRecords List<DomainReceivingRecord>
A list of DNS records for receiving validation.
SendingRecords List<DomainSendingRecord>
A list of DNS records for sending validation.
SmtpLogin string
The login email for the SMTP server.
Id string
The provider-assigned unique ID for this managed resource.
ReceivingRecords []DomainReceivingRecord
A list of DNS records for receiving validation.
SendingRecords []DomainSendingRecord
A list of DNS records for sending validation.
SmtpLogin string
The login email for the SMTP server.
id string
The provider-assigned unique ID for this managed resource.
receivingRecords DomainReceivingRecord[]
A list of DNS records for receiving validation.
sendingRecords DomainSendingRecord[]
A list of DNS records for sending validation.
smtpLogin string
The login email for the SMTP server.
id str
The provider-assigned unique ID for this managed resource.
receiving_records Sequence[DomainReceivingRecord]
A list of DNS records for receiving validation.
sending_records Sequence[DomainSendingRecord]
A list of DNS records for sending validation.
smtp_login str
The login email for the SMTP server.

Look up an Existing Domain Resource

Get an existing Domain 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?: DomainState, opts?: CustomResourceOptions): Domain
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        dkim_key_size: Optional[int] = None,
        dkim_selector: Optional[str] = None,
        name: Optional[str] = None,
        receiving_records: Optional[Sequence[DomainReceivingRecordArgs]] = None,
        region: Optional[str] = None,
        sending_records: Optional[Sequence[DomainSendingRecordArgs]] = None,
        smtp_login: Optional[str] = None,
        smtp_password: Optional[str] = None,
        spam_action: Optional[str] = None,
        wildcard: Optional[bool] = None) -> Domain
func GetDomain(ctx *Context, name string, id IDInput, state *DomainState, opts ...ResourceOption) (*Domain, error)
public static Domain Get(string name, Input<string> id, DomainState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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:

DkimKeySize int
The length of your domain’s generated DKIM key. Default value is 1024.
DkimSelector string
The name of your DKIM selector if you want to specify it whereas MailGun will make it’s own choice.
Name string
The domain to add to Mailgun
ReceivingRecords List<DomainReceivingRecordArgs>
A list of DNS records for receiving validation.
Region string
The region where domain will be created. Default value is us.
SendingRecords List<DomainSendingRecordArgs>
A list of DNS records for sending validation.
SmtpLogin string
The login email for the SMTP server.
SmtpPassword string
Password for SMTP authentication
SpamAction string
disabled or tag Disable, no spam filtering will occur for inbound messages. Tag, messages will be tagged with a spam header.
Wildcard bool
Boolean that determines whether the domain will accept email for sub-domains.
DkimKeySize int
The length of your domain’s generated DKIM key. Default value is 1024.
DkimSelector string
The name of your DKIM selector if you want to specify it whereas MailGun will make it’s own choice.
Name string
The domain to add to Mailgun
ReceivingRecords []DomainReceivingRecord
A list of DNS records for receiving validation.
Region string
The region where domain will be created. Default value is us.
SendingRecords []DomainSendingRecord
A list of DNS records for sending validation.
SmtpLogin string
The login email for the SMTP server.
SmtpPassword string
Password for SMTP authentication
SpamAction string
disabled or tag Disable, no spam filtering will occur for inbound messages. Tag, messages will be tagged with a spam header.
Wildcard bool
Boolean that determines whether the domain will accept email for sub-domains.
dkimKeySize number
The length of your domain’s generated DKIM key. Default value is 1024.
dkimSelector string
The name of your DKIM selector if you want to specify it whereas MailGun will make it’s own choice.
name string
The domain to add to Mailgun
receivingRecords DomainReceivingRecordArgs[]
A list of DNS records for receiving validation.
region string
The region where domain will be created. Default value is us.
sendingRecords DomainSendingRecordArgs[]
A list of DNS records for sending validation.
smtpLogin string
The login email for the SMTP server.
smtpPassword string
Password for SMTP authentication
spamAction string
disabled or tag Disable, no spam filtering will occur for inbound messages. Tag, messages will be tagged with a spam header.
wildcard boolean
Boolean that determines whether the domain will accept email for sub-domains.
dkim_key_size int
The length of your domain’s generated DKIM key. Default value is 1024.
dkim_selector str
The name of your DKIM selector if you want to specify it whereas MailGun will make it’s own choice.
name str
The domain to add to Mailgun
receiving_records Sequence[DomainReceivingRecordArgs]
A list of DNS records for receiving validation.
region str
The region where domain will be created. Default value is us.
sending_records Sequence[DomainSendingRecordArgs]
A list of DNS records for sending validation.
smtp_login str
The login email for the SMTP server.
smtp_password str
Password for SMTP authentication
spam_action str
disabled or tag Disable, no spam filtering will occur for inbound messages. Tag, messages will be tagged with a spam header.
wildcard bool
Boolean that determines whether the domain will accept email for sub-domains.

Supporting Types

DomainReceivingRecord

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.

DomainSendingRecord

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

Import

Domains can be imported using region:domain_name via import command. Region has to be chosen from eu or us (when no selection us is applied).

hcl

 $ pulumi import mailgun:index/domain:Domain test us:example.domain.com

Package Details

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