Skip to content

Commit c0c6a00

Browse files
committed
update docs and use known length for slices
1 parent 55049e9 commit c0c6a00

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

internal/provider/resource_tfe_team_notification_configuration.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (r *resourceTFETeamNotificationConfiguration) Schema(ctx context.Context, r
186186
},
187187

188188
"url": schema.StringAttribute{
189-
Description: "The HTTP or HTTPS URL where notification requests will be made. This value must not be provided if `destination_type` is `email`.",
189+
Description: "The HTTP or HTTPS URL where notification requests will be made. This value must not be provided if `email_addresses` or `email_user_ids` is present, or if `destination_type` is `email`.",
190190
Optional: true,
191191
Validators: []validator.String{
192192
validators.AttributeRequiredIfValueString(
@@ -269,7 +269,7 @@ func (r *resourceTFETeamNotificationConfiguration) Create(ctx context.Context, r
269269
}
270270

271271
// Add email_addresses set to the options struct
272-
emailAddresses := make([]types.String, 0)
272+
emailAddresses := make([]types.String, len(plan.EmailAddresses.Elements()))
273273
if diags := plan.EmailAddresses.ElementsAs(ctx, &emailAddresses, true); diags != nil && diags.HasError() {
274274
resp.Diagnostics.Append(diags...)
275275
return
@@ -362,7 +362,7 @@ func (r *resourceTFETeamNotificationConfiguration) Update(ctx context.Context, r
362362
}
363363

364364
// Add triggers set to the options struct
365-
triggers := make([]types.String, 0)
365+
triggers := make([]types.String, len(plan.Triggers.Elements()))
366366
if diags := plan.Triggers.ElementsAs(ctx, &triggers, true); diags != nil && diags.HasError() {
367367
resp.Diagnostics.Append(diags...)
368368
return
@@ -373,7 +373,7 @@ func (r *resourceTFETeamNotificationConfiguration) Update(ctx context.Context, r
373373
}
374374

375375
// Add email_addresses set to the options struct
376-
emailAddresses := make([]types.String, 0)
376+
emailAddresses := make([]types.String, len(plan.EmailAddresses.Elements()))
377377
if diags := plan.EmailAddresses.ElementsAs(ctx, &emailAddresses, true); diags != nil && diags.HasError() {
378378
resp.Diagnostics.Append(diags...)
379379
return
@@ -384,7 +384,7 @@ func (r *resourceTFETeamNotificationConfiguration) Update(ctx context.Context, r
384384
}
385385

386386
// Add email_user_ids set to the options struct
387-
emailUserIDs := make([]types.String, 0)
387+
emailUserIDs := make([]types.String, len(plan.EmailUserIDs.Elements()))
388388
if diags := plan.EmailUserIDs.ElementsAs(ctx, &emailUserIDs, true); diags != nil && diags.HasError() {
389389
resp.Diagnostics.Append(diags...)
390390
return

website/docs/r/team_notification_configuration.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ The following arguments are supported:
114114
- `email` available in HCP Terraform or Terraform Enterprise v202005-1 or later
115115
- `slack`
116116
- `microsoft-teams` available in HCP Terraform or Terraform Enterprise v202206-1 or later
117+
- `team_id` - (Required) The ID of the team that owns the notification configuration.
118+
- `url` - (Required if `destination_type` is `generic`, `microsoft-teams`, or `slack`) The HTTP or HTTPS URL of the notification configuration where notification requests will be made. This value _must not_ be provided if `destination_type` is `email`.
117119
- `email_addresses` - (Optional) **TFE only** A list of email addresses. This value
118120
_must not_ be provided if `destination_type` is `generic`, `microsoft-teams`, or `slack`.
119121
- `email_user_ids` - (Optional) A list of user IDs. This value _must not_ be provided
@@ -126,8 +128,6 @@ The following arguments are supported:
126128
This value _must not_ be provided if `destination_type` is `email`, `microsoft-teams`, or `slack`.
127129
- `triggers` - (Optional) The array of triggers for which this notification configuration will
128130
send notifications. Currently, the only valid value is `change_request:created`.
129-
- `url` - (Required if `destination_type` is `generic`, `microsoft-teams`, or `slack`) The HTTP or HTTPS URL of the notification configuration where notification requests will be made. This value _must not_ be provided if `destination_type` is `email`.
130-
- `team_id` - (Required) The ID of the team that owns the notification configuration.
131131

132132
## Attributes Reference
133133

0 commit comments

Comments
 (0)