The Email Routing Rule resource allows you to create and manage email routing rules for a zone.
resource "cloudflare_email_routing_rule" "main" {
zone_id = "0da42c8d2132a9ddaf714f9e7c920711"
name = "terraform rule"
enabled = true
matcher {
type = "literal"
field = "to"
value = "test@example.com"
}
action {
type = "forward"
value = ["destinationaddress@example.net"]
}
}
name
(String) Routing rule name.zone_id
(String) The zone identifier to target for the resource.action
(Block Set) Actions to take when a match is found. (see below for nested schema)enabled
(Boolean) Whether the email routing rule is enabled.matcher
(Block Set) Matching patterns to forward to your actions. (see below for nested schema)priority
(Number) The priority of the email routing rule.id
(String) The ID of the email routing rule.tag
(String) The tag of the email routing rule.action
Required:
type
(String) Type of action. Available values: forward
, worker
, drop
Optional:
value
(Set of String) Value to match on. Required for type
of literal
.matcher
Required:
type
(String) Type of matcher. Available values: literal
, all
Optional:
field
(String) Field to match on. Required for type
of literal
.value
(String) Value to match on. Required for type
of literal
.Import is supported using the following syntax:
$ terraform import cloudflare_email_routing_rule.example <zone_id>/<email_routing_rule_id>