Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions client/communications_groups.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// DO NOT MODIFY: This file is generated by tools/generate.js. Any changes will be overwritten during the next build.

package client

import (
Expand Down
2 changes: 0 additions & 2 deletions docs/resources/communications_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ Optional:

Optional:

- `email` (String) Email of the group member
- `id` (String) ID of the group member
- `name` (String) Name of the group member
- `user_id` (Number) User ID

## Import
Expand Down
40 changes: 14 additions & 26 deletions provider/resource_communications_group.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// DO NOT MODIFY: This file is generated by tools/generate.js. Any changes will be overwritten during the next build.

package provider

import (
Expand All @@ -24,6 +22,20 @@ func resourceCommunicationsGroup() *schema.Resource {
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) error {
emailChannel, emailSet := d.GetOk("email_channel")
smsChannel, smsSet := d.GetOk("sms_channel")

// Check if at least one channel is explicitly set to true
hasEmailChannel := emailSet && emailChannel.(bool)
hasSmsChannel := smsSet && smsChannel.(bool)

if !hasEmailChannel && !hasSmsChannel {
return fmt.Errorf("at least one of 'email_channel' or 'sms_channel' must be set to true")
}

return nil
},
Schema: map[string]*schema.Schema{

"name": &schema.Schema{
Expand Down Expand Up @@ -237,28 +249,6 @@ func resourceCommunicationsGroup() *schema.Resource {
WriteOnly: false,
Description: "User ID",
},

"name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Required: false,
Optional: true,
Sensitive: false,
ForceNew: false,
WriteOnly: false,
Description: "Name of the group member",
},

"email": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Required: false,
Optional: true,
Sensitive: false,
ForceNew: false,
WriteOnly: false,
Description: "Email of the group member",
},
},
},
},
Expand Down Expand Up @@ -434,8 +424,6 @@ func resourceCommunicationsGroupRead(ctx context.Context, d *schema.ResourceData
processed_item_communication_group_members := map[string]interface{}{
"id": rawItem["id"],
"user_id": rawItem["user_id"],
"name": rawItem["name"],
"email": rawItem["email"],
}
processed_items_communication_group_members = append(processed_items_communication_group_members, processed_item_communication_group_members)
}
Expand Down
Loading