Skip to content

Commit

Permalink
Validate service connector type before auth method
Browse files Browse the repository at this point in the history
  • Loading branch information
htahir1 committed Oct 27, 2024
1 parent 8af5059 commit 7fe31ea
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions internal/provider/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ var (

func validateServiceConnector(d *schema.ResourceData) error {
connectorType := d.Get("type").(string)

// Validate connector type first
validType := false
for _, t := range validConnectorTypes {
if t == connectorType {
validType = true
break
}
}
if !validType {
return fmt.Errorf("invalid connector type %q. Valid types are: %s",
connectorType, strings.Join(validConnectorTypes, ", "))
}

authMethod := d.Get("auth_method").(string)

// Validate auth method for connector type
Expand Down

0 comments on commit 7fe31ea

Please sign in to comment.