Skip to content

Commit

Permalink
change: added ValidateFunc for sigsci_corp_integration (#149)
Browse files Browse the repository at this point in the history
* fix: added ValidateFunc for corp_integration

* fix: typo

* Update provider/resource_corp_integration.go

Co-authored-by: Shawn Smith <[email protected]>

* fix: added backquote

---------

Co-authored-by: Shawn Smith <[email protected]>
  • Loading branch information
ponkio-o and shawnps authored Mar 27, 2023
1 parent d7f8e0f commit 3dbc5b0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions provider/resource_corp_integration.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package provider

import (
"fmt"
"log"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
Expand All @@ -22,6 +23,12 @@ func resourceCorpIntegration() *schema.Resource {
Description: "One of (mailingList, slack, microsoftTeams)",
Required: true,
ForceNew: true,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
if !existsInString(val.(string), "mailingList", "slack", "microsoftTeams") {
return nil, []error{fmt.Errorf(`"received type %q is invalid. should be "mailingList", "slack", or "microsoftTeams"`, val.(string))}
}
return nil, nil
},
},
"url": {
Type: schema.TypeString,
Expand Down

0 comments on commit 3dbc5b0

Please sign in to comment.