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

mailgun.DomainCredential

Explore with Pulumi AI

Provides a Mailgun domain credential resource. This can be used to create and manage credential in domain of Mailgun.

Note: Please note that starting of v0.6.1 due to using new Mailgun Client API (v4), there is no possibility to retrieve previously created secrets via API. In order get it worked, it’s recommended to mark password as ignored under lifecycle block. See below.

Example Usage

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

// Create a new Mailgun credential
const foobar = new mailgun.DomainCredential("foobar", {
    domain: "toto.com",
    login: "test",
    password: "supersecretpassword1234",
    region: "us",
});
Copy
import pulumi
import pulumi_mailgun as mailgun

# Create a new Mailgun credential
foobar = mailgun.DomainCredential("foobar",
    domain="toto.com",
    login="test",
    password="supersecretpassword1234",
    region="us")
Copy
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 {
		// Create a new Mailgun credential
		_, err := mailgun.NewDomainCredential(ctx, "foobar", &mailgun.DomainCredentialArgs{
			Domain:   pulumi.String("toto.com"),
			Login:    pulumi.String("test"),
			Password: pulumi.String("supersecretpassword1234"),
			Region:   pulumi.String("us"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mailgun = Pulumi.Mailgun;

return await Deployment.RunAsync(() => 
{
    // Create a new Mailgun credential
    var foobar = new Mailgun.DomainCredential("foobar", new()
    {
        Domain = "toto.com",
        Login = "test",
        Password = "supersecretpassword1234",
        Region = "us",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mailgun.DomainCredential;
import com.pulumi.mailgun.DomainCredentialArgs;
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) {
        // Create a new Mailgun credential
        var foobar = new DomainCredential("foobar", DomainCredentialArgs.builder()
            .domain("toto.com")
            .login("test")
            .password("supersecretpassword1234")
            .region("us")
            .build());

    }
}
Copy
resources:
  # Create a new Mailgun credential
  foobar:
    type: mailgun:DomainCredential
    properties:
      domain: toto.com
      login: test
      password: supersecretpassword1234
      region: us
Copy

Create DomainCredential Resource

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

Constructor syntax

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

@overload
def DomainCredential(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     domain: Optional[str] = None,
                     login: Optional[str] = None,
                     password: Optional[str] = None,
                     region: Optional[str] = None)
func NewDomainCredential(ctx *Context, name string, args DomainCredentialArgs, opts ...ResourceOption) (*DomainCredential, error)
public DomainCredential(string name, DomainCredentialArgs args, CustomResourceOptions? opts = null)
public DomainCredential(String name, DomainCredentialArgs args)
public DomainCredential(String name, DomainCredentialArgs args, CustomResourceOptions options)
type: mailgun:DomainCredential
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. DomainCredentialArgs
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. DomainCredentialArgs
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. DomainCredentialArgs
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. DomainCredentialArgs
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. DomainCredentialArgs
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 domainCredentialResource = new Mailgun.DomainCredential("domainCredentialResource", new()
{
    Domain = "string",
    Login = "string",
    Password = "string",
    Region = "string",
});
Copy
example, err := mailgun.NewDomainCredential(ctx, "domainCredentialResource", &mailgun.DomainCredentialArgs{
	Domain:   pulumi.String("string"),
	Login:    pulumi.String("string"),
	Password: pulumi.String("string"),
	Region:   pulumi.String("string"),
})
Copy
var domainCredentialResource = new DomainCredential("domainCredentialResource", DomainCredentialArgs.builder()
    .domain("string")
    .login("string")
    .password("string")
    .region("string")
    .build());
Copy
domain_credential_resource = mailgun.DomainCredential("domainCredentialResource",
    domain="string",
    login="string",
    password="string",
    region="string")
Copy
const domainCredentialResource = new mailgun.DomainCredential("domainCredentialResource", {
    domain: "string",
    login: "string",
    password: "string",
    region: "string",
});
Copy
type: mailgun:DomainCredential
properties:
    domain: string
    login: string
    password: string
    region: string
Copy

DomainCredential 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 DomainCredential resource accepts the following input properties:

Domain
This property is required.
Changes to this property will trigger replacement.
string
The domain to add credential of Mailgun.
Login
This property is required.
Changes to this property will trigger replacement.
string
The local-part of the email address to create.
Password This property is required. string
Password for user authentication.
Region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
Domain
This property is required.
Changes to this property will trigger replacement.
string
The domain to add credential of Mailgun.
Login
This property is required.
Changes to this property will trigger replacement.
string
The local-part of the email address to create.
Password This property is required. string
Password for user authentication.
Region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
domain
This property is required.
Changes to this property will trigger replacement.
String
The domain to add credential of Mailgun.
login
This property is required.
Changes to this property will trigger replacement.
String
The local-part of the email address to create.
password This property is required. String
Password for user authentication.
region Changes to this property will trigger replacement. String
The region where domain will be created. Default value is us.
domain
This property is required.
Changes to this property will trigger replacement.
string
The domain to add credential of Mailgun.
login
This property is required.
Changes to this property will trigger replacement.
string
The local-part of the email address to create.
password This property is required. string
Password for user authentication.
region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
domain
This property is required.
Changes to this property will trigger replacement.
str
The domain to add credential of Mailgun.
login
This property is required.
Changes to this property will trigger replacement.
str
The local-part of the email address to create.
password This property is required. str
Password for user authentication.
region Changes to this property will trigger replacement. str
The region where domain will be created. Default value is us.
domain
This property is required.
Changes to this property will trigger replacement.
String
The domain to add credential of Mailgun.
login
This property is required.
Changes to this property will trigger replacement.
String
The local-part of the email address to create.
password This property is required. String
Password for user authentication.
region Changes to this property will trigger replacement. String
The region where domain will be created. Default value is us.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing DomainCredential Resource

Get an existing DomainCredential 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?: DomainCredentialState, opts?: CustomResourceOptions): DomainCredential
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        domain: Optional[str] = None,
        login: Optional[str] = None,
        password: Optional[str] = None,
        region: Optional[str] = None) -> DomainCredential
func GetDomainCredential(ctx *Context, name string, id IDInput, state *DomainCredentialState, opts ...ResourceOption) (*DomainCredential, error)
public static DomainCredential Get(string name, Input<string> id, DomainCredentialState? state, CustomResourceOptions? opts = null)
public static DomainCredential get(String name, Output<String> id, DomainCredentialState state, CustomResourceOptions options)
resources:  _:    type: mailgun:DomainCredential    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:
Domain Changes to this property will trigger replacement. string
The domain to add credential of Mailgun.
Login Changes to this property will trigger replacement. string
The local-part of the email address to create.
Password string
Password for user authentication.
Region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
Domain Changes to this property will trigger replacement. string
The domain to add credential of Mailgun.
Login Changes to this property will trigger replacement. string
The local-part of the email address to create.
Password string
Password for user authentication.
Region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
domain Changes to this property will trigger replacement. String
The domain to add credential of Mailgun.
login Changes to this property will trigger replacement. String
The local-part of the email address to create.
password String
Password for user authentication.
region Changes to this property will trigger replacement. String
The region where domain will be created. Default value is us.
domain Changes to this property will trigger replacement. string
The domain to add credential of Mailgun.
login Changes to this property will trigger replacement. string
The local-part of the email address to create.
password string
Password for user authentication.
region Changes to this property will trigger replacement. string
The region where domain will be created. Default value is us.
domain Changes to this property will trigger replacement. str
The domain to add credential of Mailgun.
login Changes to this property will trigger replacement. str
The local-part of the email address to create.
password str
Password for user authentication.
region Changes to this property will trigger replacement. str
The region where domain will be created. Default value is us.
domain Changes to this property will trigger replacement. String
The domain to add credential of Mailgun.
login Changes to this property will trigger replacement. String
The local-part of the email address to create.
password String
Password for user authentication.
region Changes to this property will trigger replacement. String
The region where domain will be created. Default value is us.

Import

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

Password is always exported to null.

hcl

$ pulumi import mailgun:index/domainCredential:DomainCredential test us:test@domain.com
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Mailgun pulumi/pulumi-mailgun
License
Apache-2.0
Notes
This Pulumi package is based on the mailgun Terraform Provider.