Skip to content

Commit

Permalink
update the channel regex
Browse files Browse the repository at this point in the history
  • Loading branch information
brookesargent committed Sep 3, 2024
1 parent b2f8d6f commit ae376e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion honeycombio/resource_slack_recipient.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
honeycombio "github.com/honeycombio/terraform-provider-honeycombio/client"
)

var channelRegex = regexp.MustCompile(`^#.*|^@.*|^(C|D|G)[A-Z0-9]{6,}$`)

func newSlackRecipient() *schema.Resource {
return &schema.Resource{
CreateContext: resourceSlackRecipientCreate,
Expand All @@ -27,7 +29,7 @@ func newSlackRecipient() *schema.Resource {
Type: schema.TypeString,
Required: true,
Description: "The Slack channel or username to send the notification to. Must begin with `#` or `@`.",
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^(#|@).+`), "channel must begin with `#` or `@`"),
ValidateFunc: validation.StringMatch(channelRegex, "channel must begin with `#` or `@` or be a valid channel id e.g. `CABC123DEF`"),
},
},
}
Expand Down

0 comments on commit ae376e9

Please sign in to comment.