cloudflare logo
Cloudflare v5.2.1, May 23 23

cloudflare.EmailRoutingRule

Explore with Pulumi AI

Provides a resource for managing Email Routing rules.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;

return await Deployment.RunAsync(() => 
{
    var main = new Cloudflare.EmailRoutingRule("main", new()
    {
        Actions = new[]
        {
            new Cloudflare.Inputs.EmailRoutingRuleActionArgs
            {
                Type = "forward",
                Values = new[]
                {
                    "destinationaddress@example.net",
                },
            },
        },
        Enabled = true,
        Matchers = new[]
        {
            new Cloudflare.Inputs.EmailRoutingRuleMatcherArgs
            {
                Field = "to",
                Type = "literal",
                Value = "test@example.com",
            },
        },
        Name = "terraform rule",
        ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
    });

});
package main

import (
	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudflare.NewEmailRoutingRule(ctx, "main", &cloudflare.EmailRoutingRuleArgs{
			Actions: cloudflare.EmailRoutingRuleActionArray{
				&cloudflare.EmailRoutingRuleActionArgs{
					Type: pulumi.String("forward"),
					Values: pulumi.StringArray{
						pulumi.String("destinationaddress@example.net"),
					},
				},
			},
			Enabled: pulumi.Bool(true),
			Matchers: cloudflare.EmailRoutingRuleMatcherArray{
				&cloudflare.EmailRoutingRuleMatcherArgs{
					Field: pulumi.String("to"),
					Type:  pulumi.String("literal"),
					Value: pulumi.String("test@example.com"),
				},
			},
			Name:   pulumi.String("terraform rule"),
			ZoneId: pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
		})
		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.cloudflare.EmailRoutingRule;
import com.pulumi.cloudflare.EmailRoutingRuleArgs;
import com.pulumi.cloudflare.inputs.EmailRoutingRuleActionArgs;
import com.pulumi.cloudflare.inputs.EmailRoutingRuleMatcherArgs;
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 main = new EmailRoutingRule("main", EmailRoutingRuleArgs.builder()        
            .actions(EmailRoutingRuleActionArgs.builder()
                .type("forward")
                .values("destinationaddress@example.net")
                .build())
            .enabled(true)
            .matchers(EmailRoutingRuleMatcherArgs.builder()
                .field("to")
                .type("literal")
                .value("test@example.com")
                .build())
            .name("terraform rule")
            .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
            .build());

    }
}
import pulumi
import pulumi_cloudflare as cloudflare

main = cloudflare.EmailRoutingRule("main",
    actions=[cloudflare.EmailRoutingRuleActionArgs(
        type="forward",
        values=["destinationaddress@example.net"],
    )],
    enabled=True,
    matchers=[cloudflare.EmailRoutingRuleMatcherArgs(
        field="to",
        type="literal",
        value="test@example.com",
    )],
    name="terraform rule",
    zone_id="0da42c8d2132a9ddaf714f9e7c920711")
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

const main = new cloudflare.EmailRoutingRule("main", {
    actions: [{
        type: "forward",
        values: ["destinationaddress@example.net"],
    }],
    enabled: true,
    matchers: [{
        field: "to",
        type: "literal",
        value: "test@example.com",
    }],
    name: "terraform rule",
    zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
});
resources:
  main:
    type: cloudflare:EmailRoutingRule
    properties:
      actions:
        - type: forward
          values:
            - destinationaddress@example.net
      enabled: true
      matchers:
        - field: to
          type: literal
          value: test@example.com
      name: terraform rule
      zoneId: 0da42c8d2132a9ddaf714f9e7c920711

Create EmailRoutingRule Resource

new EmailRoutingRule(name: string, args: EmailRoutingRuleArgs, opts?: CustomResourceOptions);
@overload
def EmailRoutingRule(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     actions: Optional[Sequence[EmailRoutingRuleActionArgs]] = None,
                     enabled: Optional[bool] = None,
                     matchers: Optional[Sequence[EmailRoutingRuleMatcherArgs]] = None,
                     name: Optional[str] = None,
                     priority: Optional[int] = None,
                     zone_id: Optional[str] = None)
@overload
def EmailRoutingRule(resource_name: str,
                     args: EmailRoutingRuleArgs,
                     opts: Optional[ResourceOptions] = None)
func NewEmailRoutingRule(ctx *Context, name string, args EmailRoutingRuleArgs, opts ...ResourceOption) (*EmailRoutingRule, error)
public EmailRoutingRule(string name, EmailRoutingRuleArgs args, CustomResourceOptions? opts = null)
public EmailRoutingRule(String name, EmailRoutingRuleArgs args)
public EmailRoutingRule(String name, EmailRoutingRuleArgs args, CustomResourceOptions options)
type: cloudflare:EmailRoutingRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

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

Actions List<EmailRoutingRuleActionArgs>

List actions patterns.

Matchers List<EmailRoutingRuleMatcherArgs>

Matching patterns to forward to your actions.

Name string

Routing rule name.

ZoneId string

The zone identifier to target for the resource.

Enabled bool

Routing rule status.

Priority int

Priority of the routing rule.

Actions []EmailRoutingRuleActionArgs

List actions patterns.

Matchers []EmailRoutingRuleMatcherArgs

Matching patterns to forward to your actions.

Name string

Routing rule name.

ZoneId string

The zone identifier to target for the resource.

Enabled bool

Routing rule status.

Priority int

Priority of the routing rule.

actions List<EmailRoutingRuleActionArgs>

List actions patterns.

matchers List<EmailRoutingRuleMatcherArgs>

Matching patterns to forward to your actions.

name String

Routing rule name.

zoneId String

The zone identifier to target for the resource.

enabled Boolean

Routing rule status.

priority Integer

Priority of the routing rule.

actions EmailRoutingRuleActionArgs[]

List actions patterns.

matchers EmailRoutingRuleMatcherArgs[]

Matching patterns to forward to your actions.

name string

Routing rule name.

zoneId string

The zone identifier to target for the resource.

enabled boolean

Routing rule status.

priority number

Priority of the routing rule.

actions Sequence[EmailRoutingRuleActionArgs]

List actions patterns.

matchers Sequence[EmailRoutingRuleMatcherArgs]

Matching patterns to forward to your actions.

name str

Routing rule name.

zone_id str

The zone identifier to target for the resource.

enabled bool

Routing rule status.

priority int

Priority of the routing rule.

actions List<Property Map>

List actions patterns.

matchers List<Property Map>

Matching patterns to forward to your actions.

name String

Routing rule name.

zoneId String

The zone identifier to target for the resource.

enabled Boolean

Routing rule status.

priority Number

Priority of the routing rule.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Tag string

Routing rule identifier.

Id string

The provider-assigned unique ID for this managed resource.

Tag string

Routing rule identifier.

id String

The provider-assigned unique ID for this managed resource.

tag String

Routing rule identifier.

id string

The provider-assigned unique ID for this managed resource.

tag string

Routing rule identifier.

id str

The provider-assigned unique ID for this managed resource.

tag str

Routing rule identifier.

id String

The provider-assigned unique ID for this managed resource.

tag String

Routing rule identifier.

Look up Existing EmailRoutingRule Resource

Get an existing EmailRoutingRule 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?: EmailRoutingRuleState, opts?: CustomResourceOptions): EmailRoutingRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        actions: Optional[Sequence[EmailRoutingRuleActionArgs]] = None,
        enabled: Optional[bool] = None,
        matchers: Optional[Sequence[EmailRoutingRuleMatcherArgs]] = None,
        name: Optional[str] = None,
        priority: Optional[int] = None,
        tag: Optional[str] = None,
        zone_id: Optional[str] = None) -> EmailRoutingRule
func GetEmailRoutingRule(ctx *Context, name string, id IDInput, state *EmailRoutingRuleState, opts ...ResourceOption) (*EmailRoutingRule, error)
public static EmailRoutingRule Get(string name, Input<string> id, EmailRoutingRuleState? state, CustomResourceOptions? opts = null)
public static EmailRoutingRule get(String name, Output<String> id, EmailRoutingRuleState 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:
Actions List<EmailRoutingRuleActionArgs>

List actions patterns.

Enabled bool

Routing rule status.

Matchers List<EmailRoutingRuleMatcherArgs>

Matching patterns to forward to your actions.

Name string

Routing rule name.

Priority int

Priority of the routing rule.

Tag string

Routing rule identifier.

ZoneId string

The zone identifier to target for the resource.

Actions []EmailRoutingRuleActionArgs

List actions patterns.

Enabled bool

Routing rule status.

Matchers []EmailRoutingRuleMatcherArgs

Matching patterns to forward to your actions.

Name string

Routing rule name.

Priority int

Priority of the routing rule.

Tag string

Routing rule identifier.

ZoneId string

The zone identifier to target for the resource.

actions List<EmailRoutingRuleActionArgs>

List actions patterns.

enabled Boolean

Routing rule status.

matchers List<EmailRoutingRuleMatcherArgs>

Matching patterns to forward to your actions.

name String

Routing rule name.

priority Integer

Priority of the routing rule.

tag String

Routing rule identifier.

zoneId String

The zone identifier to target for the resource.

actions EmailRoutingRuleActionArgs[]

List actions patterns.

enabled boolean

Routing rule status.

matchers EmailRoutingRuleMatcherArgs[]

Matching patterns to forward to your actions.

name string

Routing rule name.

priority number

Priority of the routing rule.

tag string

Routing rule identifier.

zoneId string

The zone identifier to target for the resource.

actions Sequence[EmailRoutingRuleActionArgs]

List actions patterns.

enabled bool

Routing rule status.

matchers Sequence[EmailRoutingRuleMatcherArgs]

Matching patterns to forward to your actions.

name str

Routing rule name.

priority int

Priority of the routing rule.

tag str

Routing rule identifier.

zone_id str

The zone identifier to target for the resource.

actions List<Property Map>

List actions patterns.

enabled Boolean

Routing rule status.

matchers List<Property Map>

Matching patterns to forward to your actions.

name String

Routing rule name.

priority Number

Priority of the routing rule.

tag String

Routing rule identifier.

zoneId String

The zone identifier to target for the resource.

Supporting Types

EmailRoutingRuleAction

Type string

Type of supported action.

Values List<string>

An array with items in the following form.

Type string

Type of supported action.

Values []string

An array with items in the following form.

type String

Type of supported action.

values List<String>

An array with items in the following form.

type string

Type of supported action.

values string[]

An array with items in the following form.

type str

Type of supported action.

values Sequence[str]

An array with items in the following form.

type String

Type of supported action.

values List<String>

An array with items in the following form.

EmailRoutingRuleMatcher

Type string

Type of matcher.

Field string

Field for type matcher.

Value string

Value for matcher.

Type string

Type of matcher.

Field string

Field for type matcher.

Value string

Value for matcher.

type String

Type of matcher.

field String

Field for type matcher.

value String

Value for matcher.

type string

Type of matcher.

field string

Field for type matcher.

value string

Value for matcher.

type str

Type of matcher.

field str

Field for type matcher.

value str

Value for matcher.

type String

Type of matcher.

field String

Field for type matcher.

value String

Value for matcher.

Package Details

Repository
Cloudflare pulumi/pulumi-cloudflare
License
Apache-2.0
Notes

This Pulumi package is based on the cloudflare Terraform Provider.