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

Do not allow slug to be set for unnamed policies #86

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

bbarnes52
Copy link
Contributor

@bbarnes52 bbarnes52 commented Oct 29, 2024

Slug should not be allowed for inline policies. This invariant was inadvertently relaxed in #83 though never released.

Scenario test build 25 completed successfully.

@bbarnes52 bbarnes52 force-pushed the bgb/slugnotallowedifunnamed branch 2 times, most recently from 00665da to 2d65c74 Compare October 29, 2024 19:41
@bbarnes52 bbarnes52 marked this pull request as ready for review October 29, 2024 20:27
@bbarnes52 bbarnes52 requested a review from a team as a code owner October 29, 2024 20:27
@bbarnes52 bbarnes52 changed the title Do not allow slug to bet set for unnamed policies Do not allow slug to be set for unnamed policies Oct 29, 2024
@bbarnes52 bbarnes52 force-pushed the bgb/slugnotallowedifunnamed branch from 2d65c74 to 3712cc9 Compare October 29, 2024 20:48
CHANGELOG.md Outdated
@@ -4,6 +4,7 @@

Added:
* Allow `chronosphere_notification_policy` resources without a `team_id`.
* Reject unnamed `chronosphere_notification_policy` resources that set a `slug`
Copy link
Contributor

Choose a reason for hiding this comment

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

was this already the case prior to the above change? if so, i think we can drop this, and add a skip-changelog label to the PR to skip the changelog check

@@ -320,6 +329,10 @@ func expandNotificationPolicyRaw(

// expandNotificationPolicy converts a notification policy resource to the corresponding API model type.
func expandNotificationPolicy(p *intschema.NotificationPolicy) (*NotificationPolicyData, error) {
isInline := p.Name == ""
if p.Slug != "" && isInline {
return nil, fmt.Errorf("cannot set slug for unnamed policy, can only set slug for policy with name set")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: not sure why this error message is inconsistent with the one above, should we use the same message in both places?

@bbarnes52 bbarnes52 force-pushed the bgb/slugnotallowedifunnamed branch from 3712cc9 to 4ecb2a8 Compare October 29, 2024 20:54
@bbarnes52 bbarnes52 merged commit ab1f12e into main Oct 29, 2024
2 checks passed
@bbarnes52 bbarnes52 deleted the bgb/slugnotallowedifunnamed branch October 29, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants