From ae376e9d0b3144bc6eb0056eb20906aea5fd15c6 Mon Sep 17 00:00:00 2001 From: brookesargent Date: Tue, 3 Sep 2024 12:45:37 -0400 Subject: [PATCH] update the channel regex --- honeycombio/resource_slack_recipient.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/honeycombio/resource_slack_recipient.go b/honeycombio/resource_slack_recipient.go index c7d8ac72..717077eb 100644 --- a/honeycombio/resource_slack_recipient.go +++ b/honeycombio/resource_slack_recipient.go @@ -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, @@ -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`"), }, }, }