Skip to content
Open
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
11 changes: 11 additions & 0 deletions .changelog/3795.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:enhancement
data-source/mongodbatlas_alert_configuration: Adds `severity_override` attribute
```

```release-note:enhancement
Copy link
Member

@lantoli lantoli Oct 23, 2025

Choose a reason for hiding this comment

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

documentation for the new attribute is not updated, or will be in a follow-up PR? (update is small so could go here)

Copy link
Author

Choose a reason for hiding this comment

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

I updated docs/resources/alert_configuration.md

Copy link
Member

Choose a reason for hiding this comment

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

thanks, also docs/data-sources needs update

data-source/mongodbatlas_alert_configurations: Adds `severity_override` attribute
```

```release-note:enhancement
resource/mongodbatlas_alert_configuration: Adds `severity_override` attribute
```
1 change: 1 addition & 0 deletions contributing/testing-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- `Basic import tests` are done as the last step in the `basic acceptance tests`, not as a different test, e.g. [basicTestCase](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/66c44e62c9afe04ffe8be0dbccaec682bab830e6/internal/service/searchindex/resource_search_index_test.go#L211). Exceptions apply for more specific import tests, e.g. testing with incorrect IDs. [Import tests](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/import#resource-acceptance-testing-implementation) verify that the [Terraform Import](https://developer.hashicorp.com/terraform/cli/import) functionality is working fine.
- Data sources are tested in the same tests as the resources, e.g. [commonChecks](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/66c44e62c9afe04ffe8be0dbccaec682bab830e6/internal/service/searchindex/resource_search_index_test.go#L262-L263).
- Helper functions such as `resource.TestCheckTypeSetElemNestedAttrs` or `resource.TestCheckTypeSetElemAttr` can be used to check resource and data source attributes more easily, e.g. [resource_serverless_instance_test.go](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/66c44e62c9afe04ffe8be0dbccaec682bab830e6/internal/service/serverlessinstance/resource_serverless_instance_test.go#L61).
- Note: before running the acceptance tests, make sure you set the environment variable `TF_ACC=1`.

### Cloud Gov tests

Expand Down
3 changes: 3 additions & 0 deletions docs/resources/alert_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ resource "mongodbatlas_alert_configuration" "test" {


-> **NOTE:** If `event_type` is set to `OUTSIDE_METRIC_THRESHOLD` or `OUTSIDE_SERVERLESS_METRIC_THRESHOLD`, the `metric_threshold_config` field must also be configured.
* `severity_override` - (Optional) Severity of the event. For the list of accepted values please read the [Create One Alert Configuration in One Project](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-creategroupalertconfig) API documentation

-> **NOTE:** To reset the value of this attribute to default value, you must explicity set it to ERROR (default in MongoDB Atlas)

### Matchers
Rules to apply when matching an object against this alert configuration. Only entities that match all these rules are checked for an alert condition. You can filter using the matchers array only when the eventTypeName specifies an event for a host, replica set, or sharded cluster.
Expand Down
8 changes: 8 additions & 0 deletions internal/service/alertconfiguration/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type TFAlertConfigurationDSModel struct {
EventType types.String `tfsdk:"event_type"`
Created types.String `tfsdk:"created"`
Updated types.String `tfsdk:"updated"`
SeverityOverride types.String `tfsdk:"severity_override"`
Matcher []TfMatcherModel `tfsdk:"matcher"`
MetricThresholdConfig []TfMetricThresholdConfigModel `tfsdk:"metric_threshold_config"`
ThresholdConfig []TfThresholdConfigModel `tfsdk:"threshold_config"`
Expand Down Expand Up @@ -242,6 +243,9 @@ var alertConfigDSSchemaAttributes = map[string]schema.Attribute{
},
},
},
"severity_override": schema.StringAttribute{
Optional: true,
},
}

func (d *alertConfigurationDS) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
Expand Down Expand Up @@ -339,6 +343,10 @@ func outputAlertConfigurationResourceHcl(label string, alert *admin.GroupAlertsC
appendBlockWithCtyValues(resource, "notification", []string{}, convertNotificationToCtyValues(&notifications[i]))
}

if alert.SeverityOverride != nil {
resource.SetAttributeValue("severity_override", cty.StringVal(*alert.SeverityOverride))
}

return string(f.Bytes())
}

Expand Down
2 changes: 2 additions & 0 deletions internal/service/alertconfiguration/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func NewTFAlertConfigurationModel(apiRespConfig *admin.GroupAlertsConfig, currSt
ThresholdConfig: NewTFThresholdConfigModel(apiRespConfig.Threshold, currState.ThresholdConfig),
Notification: NewTFNotificationModelList(apiRespConfig.GetNotifications(), currState.Notification),
Matcher: NewTFMatcherModelList(apiRespConfig.GetMatchers(), currState.Matcher),
SeverityOverride: types.StringPointerValue(apiRespConfig.SeverityOverride),
}
}

Expand Down Expand Up @@ -298,6 +299,7 @@ func NewTfAlertConfigurationDSModel(apiRespConfig *admin.GroupAlertsConfig, proj
ThresholdConfig: NewTFThresholdConfigModel(apiRespConfig.Threshold, []TfThresholdConfigModel{}),
Notification: NewTFNotificationModelList(apiRespConfig.GetNotifications(), []TfNotificationModel{}),
Matcher: NewTFMatcherModelList(apiRespConfig.GetMatchers(), []TfMatcherModel{}),
SeverityOverride: types.StringPointerValue(apiRespConfig.SeverityOverride),
}
}

Expand Down
Loading