Auth0

v2.14.0 published on Wednesday, Oct 26, 2022 by Pulumi

Email

With Auth0, you can have standard welcome, password reset, and account verification email-based workflows built right into Auth0. This resource allows you to configure email providers, so you can route all emails that are part of Auth0’s authentication workflows through the supported high-volume email service of your choice.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Auth0 = Pulumi.Auth0;

return await Deployment.RunAsync(() => 
{
    // This is an example on how to set up the email provider with Amazon SES.
    var amazonSesEmailProvider = new Auth0.Email("amazonSesEmailProvider", new()
    {
        Credentials = new Auth0.Inputs.EmailCredentialsArgs
        {
            AccessKeyId = "AKIAXXXXXXXXXXXXXXXX",
            Region = "us-east-1",
            SecretAccessKey = "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        },
        DefaultFromAddress = "accounts@example.com",
        Enabled = true,
    });

    // This is an example on how to set up the email provider with SMTP.
    var smtpEmailProvider = new Auth0.Email("smtpEmailProvider", new()
    {
        Credentials = new Auth0.Inputs.EmailCredentialsArgs
        {
            SmtpHost = "your.smtp.host.com",
            SmtpPass = "SMTP Password",
            SmtpPort = 583,
            SmtpUser = "SMTP Username",
        },
        DefaultFromAddress = "accounts@example.com",
        Enabled = true,
    });

    // This is an example on how to set up the email provider with Sendgrid.
    var sendgridEmailProvider = new Auth0.Email("sendgridEmailProvider", new()
    {
        Credentials = new Auth0.Inputs.EmailCredentialsArgs
        {
            ApiKey = "secretAPIKey",
        },
        DefaultFromAddress = "accounts@example.com",
        Enabled = true,
    });

});
package main

import (
	"github.com/pulumi/pulumi-auth0/sdk/v2/go/auth0"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := auth0.NewEmail(ctx, "amazonSesEmailProvider", &auth0.EmailArgs{
			Credentials: &EmailCredentialsArgs{
				AccessKeyId:     pulumi.String("AKIAXXXXXXXXXXXXXXXX"),
				Region:          pulumi.String("us-east-1"),
				SecretAccessKey: pulumi.String("7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
			},
			DefaultFromAddress: pulumi.String("accounts@example.com"),
			Enabled:            pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = auth0.NewEmail(ctx, "smtpEmailProvider", &auth0.EmailArgs{
			Credentials: &EmailCredentialsArgs{
				SmtpHost: pulumi.String("your.smtp.host.com"),
				SmtpPass: pulumi.String("SMTP Password"),
				SmtpPort: pulumi.Int(583),
				SmtpUser: pulumi.String("SMTP Username"),
			},
			DefaultFromAddress: pulumi.String("accounts@example.com"),
			Enabled:            pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = auth0.NewEmail(ctx, "sendgridEmailProvider", &auth0.EmailArgs{
			Credentials: &EmailCredentialsArgs{
				ApiKey: pulumi.String("secretAPIKey"),
			},
			DefaultFromAddress: pulumi.String("accounts@example.com"),
			Enabled:            pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.auth0.Email;
import com.pulumi.auth0.EmailArgs;
import com.pulumi.auth0.inputs.EmailCredentialsArgs;
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) {
        var amazonSesEmailProvider = new Email("amazonSesEmailProvider", EmailArgs.builder()        
            .credentials(EmailCredentialsArgs.builder()
                .accessKeyId("AKIAXXXXXXXXXXXXXXXX")
                .region("us-east-1")
                .secretAccessKey("7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
                .build())
            .defaultFromAddress("accounts@example.com")
            .enabled(true)
            .build());

        var smtpEmailProvider = new Email("smtpEmailProvider", EmailArgs.builder()        
            .credentials(EmailCredentialsArgs.builder()
                .smtpHost("your.smtp.host.com")
                .smtpPass("SMTP Password")
                .smtpPort(583)
                .smtpUser("SMTP Username")
                .build())
            .defaultFromAddress("accounts@example.com")
            .enabled(true)
            .build());

        var sendgridEmailProvider = new Email("sendgridEmailProvider", EmailArgs.builder()        
            .credentials(EmailCredentialsArgs.builder()
                .apiKey("secretAPIKey")
                .build())
            .defaultFromAddress("accounts@example.com")
            .enabled(true)
            .build());

    }
}
import pulumi
import pulumi_auth0 as auth0

# This is an example on how to set up the email provider with Amazon SES.
amazon_ses_email_provider = auth0.Email("amazonSesEmailProvider",
    credentials=auth0.EmailCredentialsArgs(
        access_key_id="AKIAXXXXXXXXXXXXXXXX",
        region="us-east-1",
        secret_access_key="7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    ),
    default_from_address="accounts@example.com",
    enabled=True)
# This is an example on how to set up the email provider with SMTP.
smtp_email_provider = auth0.Email("smtpEmailProvider",
    credentials=auth0.EmailCredentialsArgs(
        smtp_host="your.smtp.host.com",
        smtp_pass="SMTP Password",
        smtp_port=583,
        smtp_user="SMTP Username",
    ),
    default_from_address="accounts@example.com",
    enabled=True)
# This is an example on how to set up the email provider with Sendgrid.
sendgrid_email_provider = auth0.Email("sendgridEmailProvider",
    credentials=auth0.EmailCredentialsArgs(
        api_key="secretAPIKey",
    ),
    default_from_address="accounts@example.com",
    enabled=True)
import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";

// This is an example on how to set up the email provider with Amazon SES.
const amazonSesEmailProvider = new auth0.Email("amazon_ses_email_provider", {
    credentials: {
        accessKeyId: "AKIAXXXXXXXXXXXXXXXX",
        region: "us-east-1",
        secretAccessKey: "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    },
    defaultFromAddress: "accounts@example.com",
    enabled: true,
});
// This is an example on how to set up the email provider with SMTP.
const smtpEmailProvider = new auth0.Email("smtp_email_provider", {
    credentials: {
        smtpHost: "your.smtp.host.com",
        smtpPass: "SMTP Password",
        smtpPort: 583,
        smtpUser: "SMTP Username",
    },
    defaultFromAddress: "accounts@example.com",
    enabled: true,
});
// This is an example on how to set up the email provider with Sendgrid.
const sendgridEmailProvider = new auth0.Email("sendgrid_email_provider", {
    credentials: {
        apiKey: "secretAPIKey",
    },
    defaultFromAddress: "accounts@example.com",
    enabled: true,
});
resources:
  # This is an example on how to set up the email provider with Amazon SES.
  amazonSesEmailProvider:
    type: auth0:Email
    properties:
      credentials:
        accessKeyId: AKIAXXXXXXXXXXXXXXXX
        region: us-east-1
        secretAccessKey: 7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      defaultFromAddress: accounts@example.com
      enabled: true
  # This is an example on how to set up the email provider with SMTP.
  smtpEmailProvider:
    type: auth0:Email
    properties:
      credentials:
        smtpHost: your.smtp.host.com
        smtpPass: SMTP Password
        smtpPort: 583
        smtpUser: SMTP Username
      defaultFromAddress: accounts@example.com
      enabled: true
  # This is an example on how to set up the email provider with Sendgrid.
  sendgridEmailProvider:
    type: auth0:Email
    properties:
      credentials:
        apiKey: secretAPIKey
      defaultFromAddress: accounts@example.com
      enabled: true

Create Email Resource

new Email(name: string, args: EmailArgs, opts?: CustomResourceOptions);
@overload
def Email(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          credentials: Optional[EmailCredentialsArgs] = None,
          default_from_address: Optional[str] = None,
          enabled: Optional[bool] = None,
          name: Optional[str] = None)
@overload
def Email(resource_name: str,
          args: EmailArgs,
          opts: Optional[ResourceOptions] = None)
func NewEmail(ctx *Context, name string, args EmailArgs, opts ...ResourceOption) (*Email, error)
public Email(string name, EmailArgs args, CustomResourceOptions? opts = null)
public Email(String name, EmailArgs args)
public Email(String name, EmailArgs args, CustomResourceOptions options)
type: auth0:Email
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args EmailArgs
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 EmailArgs
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 EmailArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args EmailArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args EmailArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Email Resource Properties

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

Inputs

The Email resource accepts the following input properties:

Credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

DefaultFromAddress string

Email address to use as the sender when no other "from" address is specified.

Enabled bool

Indicates whether the email provider is enabled.

Name string

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

Credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

DefaultFromAddress string

Email address to use as the sender when no other "from" address is specified.

Enabled bool

Indicates whether the email provider is enabled.

Name string

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

defaultFromAddress String

Email address to use as the sender when no other "from" address is specified.

enabled Boolean

Indicates whether the email provider is enabled.

name String

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

defaultFromAddress string

Email address to use as the sender when no other "from" address is specified.

enabled boolean

Indicates whether the email provider is enabled.

name string

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

default_from_address str

Email address to use as the sender when no other "from" address is specified.

enabled bool

Indicates whether the email provider is enabled.

name str

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

credentials Property Map

Configuration settings for the credentials for the email provider.

defaultFromAddress String

Email address to use as the sender when no other "from" address is specified.

enabled Boolean

Indicates whether the email provider is enabled.

name String

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

Outputs

All input properties are implicitly available as output properties. Additionally, the Email 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 Email Resource

Get an existing Email 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?: EmailState, opts?: CustomResourceOptions): Email
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        credentials: Optional[EmailCredentialsArgs] = None,
        default_from_address: Optional[str] = None,
        enabled: Optional[bool] = None,
        name: Optional[str] = None) -> Email
func GetEmail(ctx *Context, name string, id IDInput, state *EmailState, opts ...ResourceOption) (*Email, error)
public static Email Get(string name, Input<string> id, EmailState? state, CustomResourceOptions? opts = null)
public static Email get(String name, Output<String> id, EmailState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
The following state arguments are supported:
Credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

DefaultFromAddress string

Email address to use as the sender when no other "from" address is specified.

Enabled bool

Indicates whether the email provider is enabled.

Name string

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

Credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

DefaultFromAddress string

Email address to use as the sender when no other "from" address is specified.

Enabled bool

Indicates whether the email provider is enabled.

Name string

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

defaultFromAddress String

Email address to use as the sender when no other "from" address is specified.

enabled Boolean

Indicates whether the email provider is enabled.

name String

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

defaultFromAddress string

Email address to use as the sender when no other "from" address is specified.

enabled boolean

Indicates whether the email provider is enabled.

name string

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

credentials EmailCredentialsArgs

Configuration settings for the credentials for the email provider.

default_from_address str

Email address to use as the sender when no other "from" address is specified.

enabled bool

Indicates whether the email provider is enabled.

name str

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

credentials Property Map

Configuration settings for the credentials for the email provider.

defaultFromAddress String

Email address to use as the sender when no other "from" address is specified.

enabled Boolean

Indicates whether the email provider is enabled.

name String

Name of the email provider. Options include mailgun, mandrill, sendgrid, ses, smtp, and sparkpost.

Supporting Types

EmailCredentials

AccessKeyId string

AWS Access Key ID. Used only for AWS.

ApiKey string

API Key for your email service. Will always be encrypted in our database.

ApiUser string

API User for your email service.

Domain string

Domain name.

Region string

Default region. Used only for AWS, Mailgun, and SparkPost.

SecretAccessKey string

AWS Secret Key. Will always be encrypted in our database. Used only for AWS.

SmtpHost string

Hostname or IP address of your SMTP server. Used only for SMTP.

SmtpPass string

SMTP password. Used only for SMTP.

SmtpPort int

Port used by your SMTP server. Please avoid using port 25 if possible because many providers have limitations on this port. Used only for SMTP.

SmtpUser string

SMTP username. Used only for SMTP.

AccessKeyId string

AWS Access Key ID. Used only for AWS.

ApiKey string

API Key for your email service. Will always be encrypted in our database.

ApiUser string

API User for your email service.

Domain string

Domain name.

Region string

Default region. Used only for AWS, Mailgun, and SparkPost.

SecretAccessKey string

AWS Secret Key. Will always be encrypted in our database. Used only for AWS.

SmtpHost string

Hostname or IP address of your SMTP server. Used only for SMTP.

SmtpPass string

SMTP password. Used only for SMTP.

SmtpPort int

Port used by your SMTP server. Please avoid using port 25 if possible because many providers have limitations on this port. Used only for SMTP.

SmtpUser string

SMTP username. Used only for SMTP.

accessKeyId String

AWS Access Key ID. Used only for AWS.

apiKey String

API Key for your email service. Will always be encrypted in our database.

apiUser String

API User for your email service.

domain String

Domain name.

region String

Default region. Used only for AWS, Mailgun, and SparkPost.

secretAccessKey String

AWS Secret Key. Will always be encrypted in our database. Used only for AWS.

smtpHost String

Hostname or IP address of your SMTP server. Used only for SMTP.

smtpPass String

SMTP password. Used only for SMTP.

smtpPort Integer

Port used by your SMTP server. Please avoid using port 25 if possible because many providers have limitations on this port. Used only for SMTP.

smtpUser String

SMTP username. Used only for SMTP.

accessKeyId string

AWS Access Key ID. Used only for AWS.

apiKey string

API Key for your email service. Will always be encrypted in our database.

apiUser string

API User for your email service.

domain string

Domain name.

region string

Default region. Used only for AWS, Mailgun, and SparkPost.

secretAccessKey string

AWS Secret Key. Will always be encrypted in our database. Used only for AWS.

smtpHost string

Hostname or IP address of your SMTP server. Used only for SMTP.

smtpPass string

SMTP password. Used only for SMTP.

smtpPort number

Port used by your SMTP server. Please avoid using port 25 if possible because many providers have limitations on this port. Used only for SMTP.

smtpUser string

SMTP username. Used only for SMTP.

access_key_id str

AWS Access Key ID. Used only for AWS.

api_key str

API Key for your email service. Will always be encrypted in our database.

api_user str

API User for your email service.

domain str

Domain name.

region str

Default region. Used only for AWS, Mailgun, and SparkPost.

secret_access_key str

AWS Secret Key. Will always be encrypted in our database. Used only for AWS.

smtp_host str

Hostname or IP address of your SMTP server. Used only for SMTP.

smtp_pass str

SMTP password. Used only for SMTP.

smtp_port int

Port used by your SMTP server. Please avoid using port 25 if possible because many providers have limitations on this port. Used only for SMTP.

smtp_user str

SMTP username. Used only for SMTP.

accessKeyId String

AWS Access Key ID. Used only for AWS.

apiKey String

API Key for your email service. Will always be encrypted in our database.

apiUser String

API User for your email service.

domain String

Domain name.

region String

Default region. Used only for AWS, Mailgun, and SparkPost.

secretAccessKey String

AWS Secret Key. Will always be encrypted in our database. Used only for AWS.

smtpHost String

Hostname or IP address of your SMTP server. Used only for SMTP.

smtpPass String

SMTP password. Used only for SMTP.

smtpPort Number

Port used by your SMTP server. Please avoid using port 25 if possible because many providers have limitations on this port. Used only for SMTP.

smtpUser String

SMTP username. Used only for SMTP.

Import

As this is not a resource identifiable by an ID within the Auth0 Management API, email can be imported using a random string. # We recommend Version 4 UUID # Example

 $ pulumi import auth0:index/email:Email my_email_provider b4213dc2-2eed-42c3-9516-c6131a9ce0b0

Package Details

Repository
https://github.com/pulumi/pulumi-auth0
License
Apache-2.0
Notes

This Pulumi package is based on the auth0 Terraform Provider.