published on Wednesday, Jul 15, 2026 by Pulumi
published on Wednesday, Jul 15, 2026 by Pulumi
Provides a Mailgun domain credential resource. This can be used to create and manage credential in domain of Mailgun.
Note: The Mailgun API does not return previously created credential passwords on read. The provider therefore does not refresh
passwordfrom the API and only sends it to Mailgun on create or when the value in configuration changes. If your configuredpasswordvalue drifts (for example you rotate it out-of-band), use alifecycle.ignore_changes = [ password ]block to avoid spurious updates.
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",
});
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")
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
})
}
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",
});
});
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.ArrayList;
import java.util.Arrays;
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());
}
}
resources:
# Create a new Mailgun credential
foobar:
type: mailgun:DomainCredential
properties:
domain: toto.com
login: test
password: supersecretpassword1234
region: us
pulumi {
required_providers {
mailgun = {
source = "pulumi/mailgun"
}
}
}
# Create a new Mailgun credential
resource "mailgun_domaincredential" "foobar" {
domain = "toto.com"
login = "test"
password = "supersecretpassword1234"
region = "us"
}
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.
resource "mailgun_domain_credential" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args DomainCredentialArgs
- 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 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 string
- The unique name of the resource.
- args DomainCredentialArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DomainCredentialArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
});
example, err := mailgun.NewDomainCredential(ctx, "domainCredentialResource", &mailgun.DomainCredentialArgs{
Domain: pulumi.String("string"),
Login: pulumi.String("string"),
Password: pulumi.String("string"),
Region: pulumi.String("string"),
})
resource "mailgun_domain_credential" "domainCredentialResource" {
lifecycle {
create_before_destroy = true
}
domain = "string"
login = "string"
password = "string"
region = "string"
}
var domainCredentialResource = new DomainCredential("domainCredentialResource", DomainCredentialArgs.builder()
.domain("string")
.login("string")
.password("string")
.region("string")
.build());
domain_credential_resource = mailgun.DomainCredential("domainCredentialResource",
domain="string",
login="string",
password="string",
region="string")
const domainCredentialResource = new mailgun.DomainCredential("domainCredentialResource", {
domain: "string",
login: "string",
password: "string",
region: "string",
});
type: mailgun:DomainCredential
properties:
domain: string
login: string
password: string
region: string
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 string
- The domain to add credential of Mailgun.
- Login string
- The local-part of the email address to create.
- Password string
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- Region string
- The region where domain credential will be created. Default value is
us.
- Domain string
- The domain to add credential of Mailgun.
- Login string
- The local-part of the email address to create.
- Password string
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- Region string
- The region where domain credential will be created. Default value is
us.
- domain string
- The domain to add credential of Mailgun.
- login string
- The local-part of the email address to create.
- password string
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- region string
- The region where domain credential will be created. Default value is
us.
- domain String
- The domain to add credential of Mailgun.
- login String
- The local-part of the email address to create.
- password String
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- region String
- The region where domain credential will be created. Default value is
us.
- domain string
- The domain to add credential of Mailgun.
- login string
- The local-part of the email address to create.
- password string
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- region string
- The region where domain credential will be created. Default value is
us.
- domain String
- The domain to add credential of Mailgun.
- login String
- The local-part of the email address to create.
- password String
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- region String
- The region where domain credential 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 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) -> DomainCredentialfunc 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}import {
to = mailgun_domain_credential.example
id = "${id}"
}
- 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.
- 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.
- Domain string
- The domain to add credential of Mailgun.
- Login string
- The local-part of the email address to create.
- Password string
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- Region string
- The region where domain credential will be created. Default value is
us.
- Domain string
- The domain to add credential of Mailgun.
- Login string
- The local-part of the email address to create.
- Password string
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- Region string
- The region where domain credential will be created. Default value is
us.
- domain string
- The domain to add credential of Mailgun.
- login string
- The local-part of the email address to create.
- password string
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- region string
- The region where domain credential will be created. Default value is
us.
- domain String
- The domain to add credential of Mailgun.
- login String
- The local-part of the email address to create.
- password String
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- region String
- The region where domain credential will be created. Default value is
us.
- domain string
- The domain to add credential of Mailgun.
- login string
- The local-part of the email address to create.
- password string
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- region string
- The region where domain credential will be created. Default value is
us.
- domain String
- The domain to add credential of Mailgun.
- login String
- The local-part of the email address to create.
- password String
- Password for user authentication. Marked sensitive; not returned by the Mailgun API on read.
- region String
- The region where domain credential will be created. Default value is
us.
Package Details
- Repository
- Mailgun pulumi/pulumi-mailgun
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mailgunTerraform Provider.
published on Wednesday, Jul 15, 2026 by Pulumi