feat: Add per-notification operator/thresholdType control for Consumption Budget modules#7132
Conversation
Co-authored-by: segraef <19261257+segraef@users.noreply.github.com>
Co-authored-by: segraef <19261257+segraef@users.noreply.github.com>
|
@copilot have a look at https://github.com/Azure/bicep-registry-modules/actions/runs/27008032579/job/79704656273 in this regard. |
Co-authored-by: segraef <19261257+segraef@users.noreply.github.com>
The job failed on the CHANGELOG compliance test: Since this PR adds a feature (the |
|
|
||
| @export() | ||
| type notificationType = { | ||
| @description('Required. The comparison operator. The operator can be either `EqualTo`, `GreaterThan`, or `GreaterThanOrEqualTo`.') |
There was a problem hiding this comment.
| @description('Required. The comparison operator. The operator can be either `EqualTo`, `GreaterThan`, or `GreaterThanOrEqualTo`.') | |
| @description('Required. The comparison operator.') |
Redundant information that is anyways suggested automatically to the user.
| @minValue(1) | ||
| @maxValue(1000) | ||
| threshold: int | ||
| @description('Required. The type of threshold to use for the budget. The threshold type can be either `Actual` or `Forecasted`.') |
There was a problem hiding this comment.
| @description('Required. The type of threshold to use for the budget. The threshold type can be either `Actual` or `Forecasted`.') | |
| @description('Required. The type of threshold to use for the budget.') |
Redundant information that is anyways suggested automatically to the user.
| targetScope = 'managementGroup' | ||
|
|
||
| @export() | ||
| type notificationType = { |
There was a problem hiding this comment.
We usually group all types in a // Definitions // section at the bottom of the file to somewhat imply order 😄
| targetScope = 'subscription' | ||
|
|
||
| @export() | ||
| type notificationType = { |
There was a problem hiding this comment.
Same comment as per mg-scope
|
|
||
| @maxLength(5) | ||
| @description('Optional. Percent thresholds of budget for when to get a notification. Can be up to 5 thresholds, where each must be between 1 and 1000.') | ||
| @description('Optional. Deprecated: use `notifications` for per-threshold control. Percent thresholds of budget for when to get a notification. Can be up to 5 thresholds, where each must be between 1 and 1000.') |
There was a problem hiding this comment.
Why not remove it? We're pre 1.0 and can/should upgrade the module version accordingly.
That's why we have a breaking change section in which we can also explain the migration/upgrade strategy 😉
| 'Forecasted' | ||
| ]) | ||
| @description('Optional. The type of threshold to use for the budget. The threshold type can be either `Actual` or `Forecasted`.') | ||
| @description('Optional. Deprecated: use `notifications` for per-threshold control. The type of threshold to use for the budget. The threshold type can be either `Actual` or `Forecasted`.') |
There was a problem hiding this comment.
Same comment as for 'thresholds'
| type notificationType = { | ||
| @description('Required. The comparison operator. The operator can be either `EqualTo`, `GreaterThan`, or `GreaterThanOrEqualTo`.') |
There was a problem hiding this comment.
Same comment as per mg-scope
|
ping @segraef |
|
Important @copilot, this issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. Tip To prevent further actions to take effect, one of the following conditions must be met:
|
This change adds additive, per-notification control for budget alerts so a single budget can mix
ActualandForecastednotifications with independent operators. Existing behavior is preserved by keeping the currentthresholds+thresholdTypepath as fallback whennotificationsis not provided.Module contract changes (all scopes: sub/mg/rg)
notificationTypeuser-defined type withoperator, boundedthreshold, andthresholdType.@maxLength(5) param notifications notificationType[]?.thresholdsandthresholdTypedescriptions as deprecated in favor ofnotifications.Notification composition logic
notificationsis non-empty, resource notifications are built from it.thresholds+operator+thresholdTypeto keep compatibility.Generated module artifacts
README.mdandmain.jsonfiles forsub-scope,mg-scope, andrg-scopeviaSet-AVMModule.Versioning and CHANGELOG
version.jsonfrom0.1to0.2for all three scopes (sub-scope,mg-scope,rg-scope).## 0.2.0section to each scope'sCHANGELOG.mddescribing the newnotificationsparameter. This resolves the Module Compliance failure requiring the CHANGELOG to contain a section for the new module version.Pipeline Reference
Type of Change
version.json:version.json.version.json.Checklist
Set-AVMModulelocally to generate the supporting module files.