Skip to content

Commit

Permalink
add drop options to email_routing_rule
Browse files Browse the repository at this point in the history
Detail
======
 - the `action` should be one of `forward`, `worker`, `drop`, but there
   was no `drop` in latest provider.
 - ref: cloudflare#1947
  • Loading branch information
limejuny committed Jul 8, 2023
1 parent 05718d8 commit 9891284
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ func buildMatchersAndActions(d *schema.ResourceData) (matchers []cloudflare.Emai
action := item.(map[string]interface{})
ruleAction := cloudflare.EmailRoutingRuleAction{}
ruleAction.Type = action["type"].(string)
for _, value := range action["value"].([]interface{}) {
ruleAction.Value = append(ruleAction.Value, value.(string))
if val, ok := action["value"]; ok {
for _, value := range val.([]interface{}) {
ruleAction.Value = append(ruleAction.Value, value.(string))
}
}

actions = append(actions, ruleAction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func resourceCloudflareEmailRoutingRuleSchema() map[string]*schema.Schema {
Description: "Type of supported action.",
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"forward", "worker"}, true),
ValidateFunc: validation.StringInSlice([]string{"forward", "worker", "drop"}, true),
},
"value": {
Description: "An array with items in the following form.",
Expand Down

0 comments on commit 9891284

Please sign in to comment.