feat(observability): add send_resolved field (#935)

relates to STACKITTPR-283
This commit is contained in:
Ruben Hönle 2025-09-12 17:28:50 +02:00 committed by GitHub
parent b1e97e92f9
commit 4b46119433
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 110 additions and 52 deletions

View file

@ -99,6 +99,7 @@ Read-Only:
- `auth_password` (String, Sensitive) SMTP authentication password. - `auth_password` (String, Sensitive) SMTP authentication password.
- `auth_username` (String) SMTP authentication username. - `auth_username` (String) SMTP authentication username.
- `from` (String) The sender email address. Must be a valid email address - `from` (String) The sender email address. Must be a valid email address
- `send_resolved` (Boolean) Whether to notify about resolved alerts.
- `smart_host` (String) The SMTP host through which emails are sent. - `smart_host` (String) The SMTP host through which emails are sent.
- `to` (String) The email address to send notifications to. Must be a valid email address - `to` (String) The email address to send notifications to. Must be a valid email address
@ -111,6 +112,7 @@ Read-Only:
- `api_key` (String) The API key for OpsGenie. - `api_key` (String) The API key for OpsGenie.
- `api_url` (String) The host to send OpsGenie API requests to. Must be a valid URL - `api_url` (String) The host to send OpsGenie API requests to. Must be a valid URL
- `priority` (String) Priority of the alert. Possible values are: `P1`, `P2`, `P3`, `P4`, `P5`. - `priority` (String) Priority of the alert. Possible values are: `P1`, `P2`, `P3`, `P4`, `P5`.
- `send_resolved` (Boolean) Whether to notify about resolved alerts.
- `tags` (String) Comma separated list of tags attached to the notifications. - `tags` (String) Comma separated list of tags attached to the notifications.
@ -121,6 +123,7 @@ Read-Only:
- `google_chat` (Boolean) Google Chat webhooks require special handling, set this to true if the webhook is for Google Chat. - `google_chat` (Boolean) Google Chat webhooks require special handling, set this to true if the webhook is for Google Chat.
- `ms_teams` (Boolean) Microsoft Teams webhooks require special handling, set this to true if the webhook is for Microsoft Teams. - `ms_teams` (Boolean) Microsoft Teams webhooks require special handling, set this to true if the webhook is for Microsoft Teams.
- `send_resolved` (Boolean) Whether to notify about resolved alerts.
- `url` (String, Sensitive) The endpoint to send HTTP POST requests to. Must be a valid URL - `url` (String, Sensitive) The endpoint to send HTTP POST requests to. Must be a valid URL

View file

@ -104,6 +104,7 @@ Optional:
- `auth_password` (String, Sensitive) SMTP authentication password. - `auth_password` (String, Sensitive) SMTP authentication password.
- `auth_username` (String) SMTP authentication username. - `auth_username` (String) SMTP authentication username.
- `from` (String) The sender email address. Must be a valid email address - `from` (String) The sender email address. Must be a valid email address
- `send_resolved` (Boolean) Whether to notify about resolved alerts.
- `smart_host` (String) The SMTP host through which emails are sent. - `smart_host` (String) The SMTP host through which emails are sent.
- `to` (String) The email address to send notifications to. Must be a valid email address - `to` (String) The email address to send notifications to. Must be a valid email address
@ -116,6 +117,7 @@ Optional:
- `api_key` (String) The API key for OpsGenie. - `api_key` (String) The API key for OpsGenie.
- `api_url` (String) The host to send OpsGenie API requests to. Must be a valid URL - `api_url` (String) The host to send OpsGenie API requests to. Must be a valid URL
- `priority` (String) Priority of the alert. Possible values are: `P1`, `P2`, `P3`, `P4`, `P5`. - `priority` (String) Priority of the alert. Possible values are: `P1`, `P2`, `P3`, `P4`, `P5`.
- `send_resolved` (Boolean) Whether to notify about resolved alerts.
- `tags` (String) Comma separated list of tags attached to the notifications. - `tags` (String) Comma separated list of tags attached to the notifications.
@ -126,6 +128,7 @@ Optional:
- `google_chat` (Boolean) Google Chat webhooks require special handling, set this to true if the webhook is for Google Chat. - `google_chat` (Boolean) Google Chat webhooks require special handling, set this to true if the webhook is for Google Chat.
- `ms_teams` (Boolean) Microsoft Teams webhooks require special handling, set this to true if the webhook is for Microsoft Teams. - `ms_teams` (Boolean) Microsoft Teams webhooks require special handling, set this to true if the webhook is for Microsoft Teams.
- `send_resolved` (Boolean) Whether to notify about resolved alerts.
- `url` (String, Sensitive) The endpoint to send HTTP POST requests to. Must be a valid URL - `url` (String, Sensitive) The endpoint to send HTTP POST requests to. Must be a valid URL

View file

@ -220,6 +220,10 @@ func (d *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
Description: "The sender email address. Must be a valid email address", Description: "The sender email address. Must be a valid email address",
Computed: true, Computed: true,
}, },
"send_resolved": schema.BoolAttribute{
Description: "Whether to notify about resolved alerts.",
Computed: true,
},
"smart_host": schema.StringAttribute{ "smart_host": schema.StringAttribute{
Description: "The SMTP host through which emails are sent.", Description: "The SMTP host through which emails are sent.",
Computed: true, Computed: true,
@ -252,6 +256,10 @@ func (d *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
Description: "Priority of the alert. " + utils.FormatPossibleValues([]string{"P1", "P2", "P3", "P4", "P5"}...), Description: "Priority of the alert. " + utils.FormatPossibleValues([]string{"P1", "P2", "P3", "P4", "P5"}...),
Computed: true, Computed: true,
}, },
"send_resolved": schema.BoolAttribute{
Description: "Whether to notify about resolved alerts.",
Computed: true,
},
}, },
}, },
}, },
@ -273,6 +281,10 @@ func (d *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
Description: "Google Chat webhooks require special handling, set this to true if the webhook is for Google Chat.", Description: "Google Chat webhooks require special handling, set this to true if the webhook is for Google Chat.",
Computed: true, Computed: true,
}, },
"send_resolved": schema.BoolAttribute{
Description: "Whether to notify about resolved alerts.",
Computed: true,
},
}, },
}, },
}, },

View file

@ -188,6 +188,7 @@ type emailConfigsModel struct {
AuthPassword types.String `tfsdk:"auth_password"` AuthPassword types.String `tfsdk:"auth_password"`
AuthUsername types.String `tfsdk:"auth_username"` AuthUsername types.String `tfsdk:"auth_username"`
From types.String `tfsdk:"from"` From types.String `tfsdk:"from"`
SendResolved types.Bool `tfsdk:"send_resolved"`
Smarthost types.String `tfsdk:"smart_host"` Smarthost types.String `tfsdk:"smart_host"`
To types.String `tfsdk:"to"` To types.String `tfsdk:"to"`
} }
@ -197,36 +198,41 @@ var emailConfigsTypes = map[string]attr.Type{
"auth_password": types.StringType, "auth_password": types.StringType,
"auth_username": types.StringType, "auth_username": types.StringType,
"from": types.StringType, "from": types.StringType,
"send_resolved": types.BoolType,
"smart_host": types.StringType, "smart_host": types.StringType,
"to": types.StringType, "to": types.StringType,
} }
// Struct corresponding to Model.AlertConfig.receivers.opsGenieConfigs // Struct corresponding to Model.AlertConfig.receivers.opsGenieConfigs
type opsgenieConfigsModel struct { type opsgenieConfigsModel struct {
ApiKey types.String `tfsdk:"api_key"` ApiKey types.String `tfsdk:"api_key"`
ApiUrl types.String `tfsdk:"api_url"` ApiUrl types.String `tfsdk:"api_url"`
Tags types.String `tfsdk:"tags"` Tags types.String `tfsdk:"tags"`
Priority types.String `tfsdk:"priority"` Priority types.String `tfsdk:"priority"`
SendResolved types.Bool `tfsdk:"send_resolved"`
} }
var opsgenieConfigsTypes = map[string]attr.Type{ var opsgenieConfigsTypes = map[string]attr.Type{
"api_key": types.StringType, "api_key": types.StringType,
"api_url": types.StringType, "api_url": types.StringType,
"tags": types.StringType, "tags": types.StringType,
"priority": types.StringType, "priority": types.StringType,
"send_resolved": types.BoolType,
} }
// Struct corresponding to Model.AlertConfig.receivers.webHooksConfigs // Struct corresponding to Model.AlertConfig.receivers.webHooksConfigs
type webHooksConfigsModel struct { type webHooksConfigsModel struct {
Url types.String `tfsdk:"url"` Url types.String `tfsdk:"url"`
MsTeams types.Bool `tfsdk:"ms_teams"` MsTeams types.Bool `tfsdk:"ms_teams"`
GoogleChat types.Bool `tfsdk:"google_chat"` GoogleChat types.Bool `tfsdk:"google_chat"`
SendResolved types.Bool `tfsdk:"send_resolved"`
} }
var webHooksConfigsTypes = map[string]attr.Type{ var webHooksConfigsTypes = map[string]attr.Type{
"url": types.StringType, "url": types.StringType,
"ms_teams": types.BoolType, "ms_teams": types.BoolType,
"google_chat": types.BoolType, "google_chat": types.BoolType,
"send_resolved": types.BoolType,
} }
var routeDescriptions = map[string]string{ var routeDescriptions = map[string]string{
@ -629,6 +635,10 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
Description: "The sender email address. Must be a valid email address", Description: "The sender email address. Must be a valid email address",
Optional: true, Optional: true,
}, },
"send_resolved": schema.BoolAttribute{
Description: "Whether to notify about resolved alerts.",
Optional: true,
},
"smart_host": schema.StringAttribute{ "smart_host": schema.StringAttribute{
Description: "The SMTP host through which emails are sent.", Description: "The SMTP host through which emails are sent.",
Optional: true, Optional: true,
@ -664,6 +674,10 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
Description: "Priority of the alert. " + utils.FormatPossibleValues("P1", "P2", "P3", "P4", "P5"), Description: "Priority of the alert. " + utils.FormatPossibleValues("P1", "P2", "P3", "P4", "P5"),
Optional: true, Optional: true,
}, },
"send_resolved": schema.BoolAttribute{
Description: "Whether to notify about resolved alerts.",
Optional: true,
},
}, },
}, },
}, },
@ -695,6 +709,10 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
Computed: true, Computed: true,
Default: booldefault.StaticBool(false), Default: booldefault.StaticBool(false),
}, },
"send_resolved": schema.BoolAttribute{
Description: "Whether to notify about resolved alerts.",
Optional: true,
},
}, },
}, },
}, },
@ -1490,6 +1508,7 @@ func getMockAlertConfig(ctx context.Context) (alertConfigModel, error) {
mockEmailConfig, diags := types.ObjectValue(emailConfigsTypes, map[string]attr.Value{ mockEmailConfig, diags := types.ObjectValue(emailConfigsTypes, map[string]attr.Value{
"to": types.StringValue("123@gmail.com"), "to": types.StringValue("123@gmail.com"),
"smart_host": types.StringValue("smtp.gmail.com:587"), "smart_host": types.StringValue("smtp.gmail.com:587"),
"send_resolved": types.BoolValue(false),
"from": types.StringValue("xxxx@gmail.com"), "from": types.StringValue("xxxx@gmail.com"),
"auth_username": types.StringValue("xxxx@gmail.com"), "auth_username": types.StringValue("xxxx@gmail.com"),
"auth_password": types.StringValue("xxxxxxxxx"), "auth_password": types.StringValue("xxxxxxxxx"),
@ -1635,6 +1654,7 @@ func mapReceiversToAttributes(ctx context.Context, respReceivers *[]observabilit
"auth_password": types.StringPointerValue(emailConfig.AuthPassword), "auth_password": types.StringPointerValue(emailConfig.AuthPassword),
"auth_username": types.StringPointerValue(emailConfig.AuthUsername), "auth_username": types.StringPointerValue(emailConfig.AuthUsername),
"from": types.StringPointerValue(emailConfig.From), "from": types.StringPointerValue(emailConfig.From),
"send_resolved": types.BoolPointerValue(emailConfig.SendResolved),
"smart_host": types.StringPointerValue(emailConfig.Smarthost), "smart_host": types.StringPointerValue(emailConfig.Smarthost),
"to": types.StringPointerValue(emailConfig.To), "to": types.StringPointerValue(emailConfig.To),
} }
@ -1650,10 +1670,11 @@ func mapReceiversToAttributes(ctx context.Context, respReceivers *[]observabilit
if receiver.OpsgenieConfigs != nil { if receiver.OpsgenieConfigs != nil {
for _, opsgenieConfig := range *receiver.OpsgenieConfigs { for _, opsgenieConfig := range *receiver.OpsgenieConfigs {
opsGenieConfigMap := map[string]attr.Value{ opsGenieConfigMap := map[string]attr.Value{
"api_key": types.StringPointerValue(opsgenieConfig.ApiKey), "api_key": types.StringPointerValue(opsgenieConfig.ApiKey),
"api_url": types.StringPointerValue(opsgenieConfig.ApiUrl), "api_url": types.StringPointerValue(opsgenieConfig.ApiUrl),
"tags": types.StringPointerValue(opsgenieConfig.Tags), "tags": types.StringPointerValue(opsgenieConfig.Tags),
"priority": types.StringPointerValue(opsgenieConfig.Priority), "priority": types.StringPointerValue(opsgenieConfig.Priority),
"send_resolved": types.BoolPointerValue(opsgenieConfig.SendResolved),
} }
opsGenieConfigModel, diags := types.ObjectValue(opsgenieConfigsTypes, opsGenieConfigMap) opsGenieConfigModel, diags := types.ObjectValue(opsgenieConfigsTypes, opsGenieConfigMap)
if diags.HasError() { if diags.HasError() {
@ -1666,13 +1687,11 @@ func mapReceiversToAttributes(ctx context.Context, respReceivers *[]observabilit
webhooksConfigList := []attr.Value{} webhooksConfigList := []attr.Value{}
if receiver.WebHookConfigs != nil { if receiver.WebHookConfigs != nil {
for _, webhookConfig := range *receiver.WebHookConfigs { for _, webhookConfig := range *receiver.WebHookConfigs {
msTeamsValue := types.BoolPointerValue(webhookConfig.MsTeams)
googleChatValue := types.BoolPointerValue(webhookConfig.GoogleChat)
webHookConfigsMap := map[string]attr.Value{ webHookConfigsMap := map[string]attr.Value{
"url": types.StringPointerValue(webhookConfig.Url), "url": types.StringPointerValue(webhookConfig.Url),
"ms_teams": msTeamsValue, "ms_teams": types.BoolPointerValue(webhookConfig.MsTeams),
"google_chat": googleChatValue, "google_chat": types.BoolPointerValue(webhookConfig.GoogleChat),
"send_resolved": types.BoolPointerValue(webhookConfig.SendResolved),
} }
webHookConfigsModel, diags := types.ObjectValue(webHooksConfigsTypes, webHookConfigsMap) webHookConfigsModel, diags := types.ObjectValue(webHooksConfigsTypes, webHookConfigsMap)
if diags.HasError() { if diags.HasError() {
@ -1981,6 +2000,7 @@ func toReceiverPayload(ctx context.Context, model *alertConfigModel) (*[]observa
AuthPassword: conversion.StringValueToPointer(emailConfig.AuthPassword), AuthPassword: conversion.StringValueToPointer(emailConfig.AuthPassword),
AuthUsername: conversion.StringValueToPointer(emailConfig.AuthUsername), AuthUsername: conversion.StringValueToPointer(emailConfig.AuthUsername),
From: conversion.StringValueToPointer(emailConfig.From), From: conversion.StringValueToPointer(emailConfig.From),
SendResolved: conversion.BoolValueToPointer(emailConfig.SendResolved),
Smarthost: conversion.StringValueToPointer(emailConfig.Smarthost), Smarthost: conversion.StringValueToPointer(emailConfig.Smarthost),
To: conversion.StringValueToPointer(emailConfig.To), To: conversion.StringValueToPointer(emailConfig.To),
}) })
@ -1998,10 +2018,11 @@ func toReceiverPayload(ctx context.Context, model *alertConfigModel) (*[]observa
for i := range opsgenieConfigs { for i := range opsgenieConfigs {
opsgenieConfig := opsgenieConfigs[i] opsgenieConfig := opsgenieConfigs[i]
payloadOpsGenieConfigs = append(payloadOpsGenieConfigs, observability.CreateAlertConfigReceiverPayloadOpsgenieConfigsInner{ payloadOpsGenieConfigs = append(payloadOpsGenieConfigs, observability.CreateAlertConfigReceiverPayloadOpsgenieConfigsInner{
ApiKey: conversion.StringValueToPointer(opsgenieConfig.ApiKey), ApiKey: conversion.StringValueToPointer(opsgenieConfig.ApiKey),
ApiUrl: conversion.StringValueToPointer(opsgenieConfig.ApiUrl), ApiUrl: conversion.StringValueToPointer(opsgenieConfig.ApiUrl),
Tags: conversion.StringValueToPointer(opsgenieConfig.Tags), Tags: conversion.StringValueToPointer(opsgenieConfig.Tags),
Priority: conversion.StringValueToPointer(opsgenieConfig.Priority), Priority: conversion.StringValueToPointer(opsgenieConfig.Priority),
SendResolved: conversion.BoolValueToPointer(opsgenieConfig.SendResolved),
}) })
} }
receiverPayload.OpsgenieConfigs = &payloadOpsGenieConfigs receiverPayload.OpsgenieConfigs = &payloadOpsGenieConfigs
@ -2017,9 +2038,10 @@ func toReceiverPayload(ctx context.Context, model *alertConfigModel) (*[]observa
for i := range receiverWebHooksConfigs { for i := range receiverWebHooksConfigs {
webHooksConfig := receiverWebHooksConfigs[i] webHooksConfig := receiverWebHooksConfigs[i]
payloadWebHooksConfigs = append(payloadWebHooksConfigs, observability.CreateAlertConfigReceiverPayloadWebHookConfigsInner{ payloadWebHooksConfigs = append(payloadWebHooksConfigs, observability.CreateAlertConfigReceiverPayloadWebHookConfigsInner{
Url: conversion.StringValueToPointer(webHooksConfig.Url), Url: conversion.StringValueToPointer(webHooksConfig.Url),
MsTeams: conversion.BoolValueToPointer(webHooksConfig.MsTeams), MsTeams: conversion.BoolValueToPointer(webHooksConfig.MsTeams),
GoogleChat: conversion.BoolValueToPointer(webHooksConfig.GoogleChat), GoogleChat: conversion.BoolValueToPointer(webHooksConfig.GoogleChat),
SendResolved: conversion.BoolValueToPointer(webHooksConfig.SendResolved),
}) })
} }
receiverPayload.WebHookConfigs = &payloadWebHooksConfigs receiverPayload.WebHookConfigs = &payloadWebHooksConfigs

View file

@ -24,6 +24,7 @@ func fixtureEmailConfigsModel() basetypes.ListValue {
"auth_password": types.StringValue("password"), "auth_password": types.StringValue("password"),
"auth_username": types.StringValue("username"), "auth_username": types.StringValue("username"),
"from": types.StringValue("notification@example.com"), "from": types.StringValue("notification@example.com"),
"send_resolved": types.BoolValue(true),
"smart_host": types.StringValue("smtp.example.com"), "smart_host": types.StringValue("smtp.example.com"),
"to": types.StringValue("me@example.com"), "to": types.StringValue("me@example.com"),
}), }),
@ -33,10 +34,11 @@ func fixtureEmailConfigsModel() basetypes.ListValue {
func fixtureOpsGenieConfigsModel() basetypes.ListValue { func fixtureOpsGenieConfigsModel() basetypes.ListValue {
return types.ListValueMust(types.ObjectType{AttrTypes: opsgenieConfigsTypes}, []attr.Value{ return types.ListValueMust(types.ObjectType{AttrTypes: opsgenieConfigsTypes}, []attr.Value{
types.ObjectValueMust(opsgenieConfigsTypes, map[string]attr.Value{ types.ObjectValueMust(opsgenieConfigsTypes, map[string]attr.Value{
"api_key": types.StringValue("key"), "api_key": types.StringValue("key"),
"tags": types.StringValue("tag"), "tags": types.StringValue("tag"),
"api_url": types.StringValue("ops.example.com"), "api_url": types.StringValue("ops.example.com"),
"priority": types.StringValue("P3"), "priority": types.StringValue("P3"),
"send_resolved": types.BoolValue(true),
}), }),
}) })
} }
@ -44,9 +46,10 @@ func fixtureOpsGenieConfigsModel() basetypes.ListValue {
func fixtureWebHooksConfigsModel() basetypes.ListValue { func fixtureWebHooksConfigsModel() basetypes.ListValue {
return types.ListValueMust(types.ObjectType{AttrTypes: webHooksConfigsTypes}, []attr.Value{ return types.ListValueMust(types.ObjectType{AttrTypes: webHooksConfigsTypes}, []attr.Value{
types.ObjectValueMust(webHooksConfigsTypes, map[string]attr.Value{ types.ObjectValueMust(webHooksConfigsTypes, map[string]attr.Value{
"url": types.StringValue("http://example.com"), "url": types.StringValue("http://example.com"),
"ms_teams": types.BoolValue(true), "ms_teams": types.BoolValue(true),
"google_chat": types.BoolValue(true), "google_chat": types.BoolValue(true),
"send_resolved": types.BoolValue(true),
}), }),
}) })
} }
@ -135,6 +138,7 @@ func fixtureEmailConfigsPayload() observability.CreateAlertConfigReceiverPayload
AuthPassword: utils.Ptr("password"), AuthPassword: utils.Ptr("password"),
AuthUsername: utils.Ptr("username"), AuthUsername: utils.Ptr("username"),
From: utils.Ptr("notification@example.com"), From: utils.Ptr("notification@example.com"),
SendResolved: utils.Ptr(true),
Smarthost: utils.Ptr("smtp.example.com"), Smarthost: utils.Ptr("smtp.example.com"),
To: utils.Ptr("me@example.com"), To: utils.Ptr("me@example.com"),
} }
@ -142,18 +146,20 @@ func fixtureEmailConfigsPayload() observability.CreateAlertConfigReceiverPayload
func fixtureOpsGenieConfigsPayload() observability.CreateAlertConfigReceiverPayloadOpsgenieConfigsInner { func fixtureOpsGenieConfigsPayload() observability.CreateAlertConfigReceiverPayloadOpsgenieConfigsInner {
return observability.CreateAlertConfigReceiverPayloadOpsgenieConfigsInner{ return observability.CreateAlertConfigReceiverPayloadOpsgenieConfigsInner{
ApiKey: utils.Ptr("key"), ApiKey: utils.Ptr("key"),
Tags: utils.Ptr("tag"), Tags: utils.Ptr("tag"),
ApiUrl: utils.Ptr("ops.example.com"), ApiUrl: utils.Ptr("ops.example.com"),
Priority: utils.Ptr("P3"), Priority: utils.Ptr("P3"),
SendResolved: utils.Ptr(true),
} }
} }
func fixtureWebHooksConfigsPayload() observability.CreateAlertConfigReceiverPayloadWebHookConfigsInner { func fixtureWebHooksConfigsPayload() observability.CreateAlertConfigReceiverPayloadWebHookConfigsInner {
return observability.CreateAlertConfigReceiverPayloadWebHookConfigsInner{ return observability.CreateAlertConfigReceiverPayloadWebHookConfigsInner{
Url: utils.Ptr("http://example.com"), Url: utils.Ptr("http://example.com"),
MsTeams: utils.Ptr(true), MsTeams: utils.Ptr(true),
GoogleChat: utils.Ptr(true), GoogleChat: utils.Ptr(true),
SendResolved: utils.Ptr(true),
} }
} }
@ -216,6 +222,7 @@ func fixtureEmailConfigsResponse() observability.EmailConfig {
AuthPassword: utils.Ptr("password"), AuthPassword: utils.Ptr("password"),
AuthUsername: utils.Ptr("username"), AuthUsername: utils.Ptr("username"),
From: utils.Ptr("notification@example.com"), From: utils.Ptr("notification@example.com"),
SendResolved: utils.Ptr(true),
Smarthost: utils.Ptr("smtp.example.com"), Smarthost: utils.Ptr("smtp.example.com"),
To: utils.Ptr("me@example.com"), To: utils.Ptr("me@example.com"),
} }
@ -223,18 +230,20 @@ func fixtureEmailConfigsResponse() observability.EmailConfig {
func fixtureOpsGenieConfigsResponse() observability.OpsgenieConfig { func fixtureOpsGenieConfigsResponse() observability.OpsgenieConfig {
return observability.OpsgenieConfig{ return observability.OpsgenieConfig{
ApiKey: utils.Ptr("key"), ApiKey: utils.Ptr("key"),
Tags: utils.Ptr("tag"), Tags: utils.Ptr("tag"),
ApiUrl: utils.Ptr("ops.example.com"), ApiUrl: utils.Ptr("ops.example.com"),
Priority: utils.Ptr("P3"), Priority: utils.Ptr("P3"),
SendResolved: utils.Ptr(true),
} }
} }
func fixtureWebHooksConfigsResponse() observability.WebHook { func fixtureWebHooksConfigsResponse() observability.WebHook {
return observability.WebHook{ return observability.WebHook{
Url: utils.Ptr("http://example.com"), Url: utils.Ptr("http://example.com"),
MsTeams: utils.Ptr(true), MsTeams: utils.Ptr(true),
GoogleChat: utils.Ptr(true), GoogleChat: utils.Ptr(true),
SendResolved: utils.Ptr(true),
} }
} }

View file

@ -79,15 +79,18 @@ var testConfigVarsMax = config.Variables{
"auth_password": config.StringVariable("password"), "auth_password": config.StringVariable("password"),
"auth_username": config.StringVariable("username"), "auth_username": config.StringVariable("username"),
"email_from": config.StringVariable("aa@bb.ccc"), "email_from": config.StringVariable("aa@bb.ccc"),
"email_send_resolved": config.StringVariable("true"),
"smart_host": config.StringVariable("smtp.gmail.com:587"), "smart_host": config.StringVariable("smtp.gmail.com:587"),
"email_to": config.StringVariable("bb@bb.ccc"), "email_to": config.StringVariable("bb@bb.ccc"),
"opsgenie_api_key": config.StringVariable("example-api-key"), "opsgenie_api_key": config.StringVariable("example-api-key"),
"opsgenie_api_tags": config.StringVariable("observability-alert"), "opsgenie_api_tags": config.StringVariable("observability-alert"),
"opsgenie_api_url": config.StringVariable("https://api.eu.opsgenie.com"), "opsgenie_api_url": config.StringVariable("https://api.eu.opsgenie.com"),
"opsgenie_priority": config.StringVariable("P3"), "opsgenie_priority": config.StringVariable("P3"),
"opsgenie_send_resolved": config.StringVariable("false"),
"webhook_configs_url": config.StringVariable("https://example.com"), "webhook_configs_url": config.StringVariable("https://example.com"),
"ms_teams": config.StringVariable("true"), "ms_teams": config.StringVariable("true"),
"google_chat": config.StringVariable("false"), "google_chat": config.StringVariable("false"),
"webhook_configs_send_resolved": config.StringVariable("false"),
"group_by": config.StringVariable("alertname"), "group_by": config.StringVariable("alertname"),
"group_interval": config.StringVariable("10m"), "group_interval": config.StringVariable("10m"),
"group_wait": config.StringVariable("1m"), "group_wait": config.StringVariable("1m"),

View file

@ -21,15 +21,18 @@ variable "auth_identity" {}
variable "auth_password" {} variable "auth_password" {}
variable "auth_username" {} variable "auth_username" {}
variable "email_from" {} variable "email_from" {}
variable "email_send_resolved" {}
variable "smart_host" {} variable "smart_host" {}
variable "email_to" {} variable "email_to" {}
variable "opsgenie_api_key" {} variable "opsgenie_api_key" {}
variable "opsgenie_api_tags" {} variable "opsgenie_api_tags" {}
variable "opsgenie_api_url" {} variable "opsgenie_api_url" {}
variable "opsgenie_priority" {} variable "opsgenie_priority" {}
variable "opsgenie_send_resolved" {}
variable "webhook_configs_url" {} variable "webhook_configs_url" {}
variable "ms_teams" {} variable "ms_teams" {}
variable "google_chat" {} variable "google_chat" {}
variable "webhook_configs_send_resolved" {}
variable "group_by" {} variable "group_by" {}
variable "group_interval" {} variable "group_interval" {}
variable "group_wait" {} variable "group_wait" {}
@ -113,6 +116,7 @@ resource "stackit_observability_instance" "instance" {
from = var.email_from from = var.email_from
smart_host = var.smart_host smart_host = var.smart_host
to = var.email_to to = var.email_to
send_resolved = var.email_send_resolved
} }
] ]
opsgenie_configs = [ opsgenie_configs = [
@ -121,6 +125,7 @@ resource "stackit_observability_instance" "instance" {
tags = var.opsgenie_api_tags tags = var.opsgenie_api_tags
api_url = var.opsgenie_api_url api_url = var.opsgenie_api_url
priority = var.opsgenie_priority priority = var.opsgenie_priority
send_resolved = var.opsgenie_send_resolved
} }
] ]
webhooks_configs = [ webhooks_configs = [
@ -128,6 +133,7 @@ resource "stackit_observability_instance" "instance" {
url = var.webhook_configs_url url = var.webhook_configs_url
ms_teams = var.ms_teams ms_teams = var.ms_teams
google_chat = var.google_chat google_chat = var.google_chat
send_resolved = var.webhook_configs_send_resolved
} }
] ]
}, },