Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(recipients): dynamic block bug #444

Merged
merged 11 commits into from
Feb 29, 2024
Merged

Conversation

brookesargent
Copy link
Contributor

@brookesargent brookesargent commented Feb 28, 2024

Which problem is this PR solving?

Short description of the changes

Migrates NotificationRecipients to types.Set and NotificationRecipientDetails to types.List instead of slices.


@brookesargent brookesargent marked this pull request as ready for review February 28, 2024 20:17
@brookesargent brookesargent requested a review from a team as a code owner February 28, 2024 20:17
Copy link
Collaborator

@jharley jharley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great and a deep dive into the Framework without a ton of examples available. Thank you! ✨

I'm generally torn on if we should have these expand/flatten/mutate functions returning (value, diag) or passing it in: perhaps Hashi will provide some idiomatic guidance when they get their examples updated. 🤔

A few nit-ish suggestions, but all are non-blocking.

Comment on lines 153 to 154
detailsObj := map[string]attr.Value{"pagerduty_severity": types.StringValue(s)}
return []attr.Value{types.ObjectValueMust(models.NotificationRecipientDetailsAttrTypes, detailsObj)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
detailsObj := map[string]attr.Value{"pagerduty_severity": types.StringValue(s)}
return []attr.Value{types.ObjectValueMust(models.NotificationRecipientDetailsAttrTypes, detailsObj)}
return []attr.Value{types.ObjectValueMust(models.NotificationRecipientDetailsAttrTypes,
map[string]attr.Value{"pagerduty_severity": types.StringValue(s)})}

}

type NotificationRecipientDetailsModel struct {
PDSeverity types.String `tfsdk:"pagerduty_severity"`
}

var NotificationRecipientAttrTypes = map[string]attr.Type{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit-ish, but I think this should be singular

Suggested change
var NotificationRecipientAttrTypes = map[string]attr.Type{
var NotificationRecipientAttrType = map[string]attr.Type{

"notification_details": types.ListType{ElemType: types.ObjectType{AttrTypes: NotificationRecipientDetailsAttrTypes}},
}

var NotificationRecipientDetailsAttrTypes = map[string]attr.Type{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Suggested change
var NotificationRecipientDetailsAttrTypes = map[string]attr.Type{
var NotificationRecipientDetailsAttrType = map[string]attr.Type{

@jharley jharley added the bug label Feb 28, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 91.91919% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 83.28%. Comparing base (9c84dba) to head (fa09d4b).
Report is 2 commits behind head on main.

Files Patch % Lines
internal/provider/notification_recipients.go 90.80% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #444      +/-   ##
==========================================
+ Coverage   83.21%   83.28%   +0.06%     
==========================================
  Files          62       62              
  Lines        4170     4235      +65     
==========================================
+ Hits         3470     3527      +57     
- Misses        547      551       +4     
- Partials      153      157       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brookesargent brookesargent merged commit 326b190 into main Feb 29, 2024
2 checks passed
@brookesargent brookesargent deleted the brooke.fix-dynamic-recip-bug branch February 29, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

honeycombio_burn_alert > dynamic recipient "Value Conversion Error"
3 participants