From 44face1546303004bd5c3a3b7127f2f5074c1c09 Mon Sep 17 00:00:00 2001 From: Divya Singh Date: Thu, 5 Sep 2024 09:58:58 +0530 Subject: [PATCH] updated resources, data source and documentation for Slack Direct destination support --- go.mod | 2 +- go.sum | 2 + .../data_source_ibm_en_destination_cf.go | 2 +- .../data_source_ibm_en_destination_slack.go | 18 ++++ ...ta_source_ibm_en_destination_slack_test.go | 1 + .../data_source_ibm_en_slack_subscription.go | 32 ++++++ ...a_source_ibm_en_slack_subscription_test.go | 8 +- .../resource_ibm_en_destination_slack.go | 38 +++++++- .../resource_ibm_en_destination_slack_test.go | 1 + .../resource_ibm_en_subscription_slack.go | 97 ++++++++++++++++--- ...resource_ibm_en_subscription_slack_test.go | 3 +- .../docs/d/en_destination_slack.html.markdown | 2 + .../d/en_subscription_slack.html.markdown | 2 + .../docs/r/en_destination_slack.html.markdown | 24 ++++- .../r/en_subscription_slack.html.markdown | 53 +++++++++- website/docs/r/en_topic.html.markdown | 11 ++- 16 files changed, 273 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index 8a5027f40d..d6507555c5 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/IBM/code-engine-go-sdk v0.0.0-20240126185534-a6e054aa01ed github.com/IBM/container-registry-go-sdk v1.1.0 github.com/IBM/continuous-delivery-go-sdk v1.6.0 - github.com/IBM/event-notifications-go-admin-sdk v0.8.0 + github.com/IBM/event-notifications-go-admin-sdk v0.9.0 github.com/IBM/eventstreams-go-sdk v1.4.0 github.com/IBM/go-sdk-core v1.1.0 github.com/IBM/go-sdk-core/v3 v3.2.4 diff --git a/go.sum b/go.sum index f6759dbb08..90719df8ec 100644 --- a/go.sum +++ b/go.sum @@ -140,6 +140,8 @@ github.com/IBM/continuous-delivery-go-sdk v1.6.0 h1:eAL/jIWHrDFlWDF+Qd9Y5UN99Pr5 github.com/IBM/continuous-delivery-go-sdk v1.6.0/go.mod h1:nZdKUnubXNLo+zo28R4Rd+TGDqiJ/xoE8WO/A3kLw1E= github.com/IBM/event-notifications-go-admin-sdk v0.8.0 h1:xk2CYTayQtKi6LSgGGFRxFJfWUxyM5SY8Rs64ducAhw= github.com/IBM/event-notifications-go-admin-sdk v0.8.0/go.mod h1:OByvqfrNVxs7G6ggv8pwQCEVw10/TBJCLh7NM3z707w= +github.com/IBM/event-notifications-go-admin-sdk v0.9.0 h1:eaCd+GkxhNyot+8rA9WkAQdlVYrRD20LYiXjEytFO6M= +github.com/IBM/event-notifications-go-admin-sdk v0.9.0/go.mod h1:OByvqfrNVxs7G6ggv8pwQCEVw10/TBJCLh7NM3z707w= github.com/IBM/eventstreams-go-sdk v1.4.0 h1:yS/Ns29sBOe8W2tynQmz9HTKqQZ0ckse4Py5Oy/F2rM= github.com/IBM/eventstreams-go-sdk v1.4.0/go.mod h1:2tuAxaYLctfqfr5jvyqSrxxEQGMwYPm3yJGWSj85YVQ= github.com/IBM/go-sdk-core v1.1.0 h1:pV73lZqr9r1xKb3h08c1uNG3AphwoV5KzUzhS+pfEqY= diff --git a/ibm/service/eventnotification/data_source_ibm_en_destination_cf.go b/ibm/service/eventnotification/data_source_ibm_en_destination_cf.go index cda70209db..7f96913681 100644 --- a/ibm/service/eventnotification/data_source_ibm_en_destination_cf.go +++ b/ibm/service/eventnotification/data_source_ibm_en_destination_cf.go @@ -96,7 +96,7 @@ func DataSourceIBMEnCFDestination() *schema.Resource { }, }, }, - DeprecationMessage: "The IBM Cloud Function destination has been deprectated", + DeprecationMessage: "datasource is depreacted due to cloud function servie depreaction", } } diff --git a/ibm/service/eventnotification/data_source_ibm_en_destination_slack.go b/ibm/service/eventnotification/data_source_ibm_en_destination_slack.go index faaedcc8b2..8ea1b7ba7e 100644 --- a/ibm/service/eventnotification/data_source_ibm_en_destination_slack.go +++ b/ibm/service/eventnotification/data_source_ibm_en_destination_slack.go @@ -66,6 +66,16 @@ func DataSourceIBMEnSlackDestination() *schema.Resource { Computed: true, Description: "Slack webhook url", }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "The Slack Destination type incoming_webhook/direct_message", + }, + "token": { + Type: schema.TypeString, + Computed: true, + Description: "Slack Bot token. Required in case of type is direct_message", + }, }, }, }, @@ -184,5 +194,13 @@ func enSlackDestinationConfigParamsToMap(paramsItem en.DestinationConfigOneOfInt if params.URL != nil { paramsMap["url"] = params.URL } + + if params.Type != nil { + paramsMap["type"] = params.Type + } + + if params.Token != nil { + paramsMap["token"] = params.Token + } return paramsMap } diff --git a/ibm/service/eventnotification/data_source_ibm_en_destination_slack_test.go b/ibm/service/eventnotification/data_source_ibm_en_destination_slack_test.go index c759511bde..68b74da139 100644 --- a/ibm/service/eventnotification/data_source_ibm_en_destination_slack_test.go +++ b/ibm/service/eventnotification/data_source_ibm_en_destination_slack_test.go @@ -54,6 +54,7 @@ func testAccCheckIBMEnSlackDestinationDataSourceConfigBasic(instanceName, name, description = "%s" config { params { + type = "incoming_webhook" url = "https://hooks.slack.com/services/G0gyhsush/TYodsjhs/GHTbfidsimkk" } } diff --git a/ibm/service/eventnotification/data_source_ibm_en_slack_subscription.go b/ibm/service/eventnotification/data_source_ibm_en_slack_subscription.go index 33ca714ace..1d30d62d93 100644 --- a/ibm/service/eventnotification/data_source_ibm_en_slack_subscription.go +++ b/ibm/service/eventnotification/data_source_ibm_en_slack_subscription.go @@ -59,6 +59,20 @@ func DataSourceIBMEnSlackSubscription() *schema.Resource { Optional: true, Description: "attachment color code", }, + "channels": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "List of channels.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "channel id.", + }, + }, + }, + }, }, }, }, @@ -137,5 +151,23 @@ func enSlackSubscriptionToMap(attributeItem *en.SubscriptionAttributes) (attribu attributeMap["attachment_color"] = attributeItem.AttachmentColor } + if attributeItem.Channels != nil { + channels := []map[string]interface{}{} + for _, channelsItem := range attributeItem.Channels { + channelsItemMap, err := dataSourceIBMEnSubscriptionChannelCreateAttributesToMap(&channelsItem) + if err != nil { + return attributeMap + } + channels = append(channels, channelsItemMap) + } + attributeMap["channels"] = channels + } + return attributeMap } + +func dataSourceIBMEnSubscriptionChannelCreateAttributesToMap(model *en.ChannelCreateAttributes) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + return modelMap, nil +} diff --git a/ibm/service/eventnotification/data_source_ibm_en_slack_subscription_test.go b/ibm/service/eventnotification/data_source_ibm_en_slack_subscription_test.go index 391665174f..973db6aab1 100644 --- a/ibm/service/eventnotification/data_source_ibm_en_slack_subscription_test.go +++ b/ibm/service/eventnotification/data_source_ibm_en_slack_subscription_test.go @@ -64,7 +64,8 @@ func testAccCheckIBMEnSlackSubscriptionDataSourceConfig(instanceName, name, desc description = "tf_destinatios_description_0364" config { params { - url = "https://hooks.slack.com/services/G0gyhsush/TYodsjhs/GHTbfidsimkk" + type = "direct_message" + token = "dsgdewgfpwfgpewweeffewsgcvsaksdksff" } } } @@ -76,7 +77,10 @@ func testAccCheckIBMEnSlackSubscriptionDataSourceConfig(instanceName, name, desc topic_id = ibm_en_topic.en_topic_resource_4.topic_id destination_id = ibm_en_destination_slack.en_destination_resource_4.destination_id attributes { - attachment_color = "#0000FF" + channels { + id = "GFDRTUIIOBVD" + } + } } diff --git a/ibm/service/eventnotification/resource_ibm_en_destination_slack.go b/ibm/service/eventnotification/resource_ibm_en_destination_slack.go index 49fb2ba4ef..4e6b5c87ca 100644 --- a/ibm/service/eventnotification/resource_ibm_en_destination_slack.go +++ b/ibm/service/eventnotification/resource_ibm_en_destination_slack.go @@ -65,9 +65,19 @@ func ResourceIBMEnSlackDestination() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "url": { + Type: schema.TypeString, + Optional: true, + Description: "Slack webhook url. Required in case of type is incoming_webhook", + }, + "type": { Type: schema.TypeString, Required: true, - Description: "Slack webhook url.", + Description: "The Slack Destination type incoming_webhook/direct_message", + }, + "token": { + Type: schema.TypeString, + Optional: true, + Description: "Slack Bot token. Required in case of type is direct_message", }, }, }, @@ -182,7 +192,7 @@ func resourceIBMEnSlackDestinationRead(context context.Context, d *schema.Resour } if result.Config != nil { - err = d.Set("config", enWebhookDestinationFlattenConfig(*result.Config)) + err = d.Set("config", enSlackDestinationFlattenConfig(*result.Config)) if err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting config %s", err)) } @@ -279,8 +289,28 @@ func resourceIBMEnSlackDestinationDelete(context context.Context, d *schema.Reso func SlackdestinationConfigMapToDestinationConfig(configParams map[string]interface{}, destinationtype string) en.DestinationConfig { params := new(en.DestinationConfigOneOf) - if configParams["url"] != nil { - params.URL = core.StringPtr(configParams["url"].(string)) + + params.Type = core.StringPtr(configParams["type"].(string)) + + if *params.Type == "incoming_webhook" { + + if configParams["url"] != nil { + params.URL = core.StringPtr(configParams["url"].(string)) + } + + if configParams["type"] != nil { + params.Type = core.StringPtr(configParams["type"].(string)) + } + + } else { + + if configParams["token"] != nil { + params.Token = core.StringPtr(configParams["token"].(string)) + } + + if configParams["type"] != nil { + params.Type = core.StringPtr(configParams["type"].(string)) + } } destinationConfig := new(en.DestinationConfig) diff --git a/ibm/service/eventnotification/resource_ibm_en_destination_slack_test.go b/ibm/service/eventnotification/resource_ibm_en_destination_slack_test.go index 4ca12d7483..8cf00610f2 100644 --- a/ibm/service/eventnotification/resource_ibm_en_destination_slack_test.go +++ b/ibm/service/eventnotification/resource_ibm_en_destination_slack_test.go @@ -75,6 +75,7 @@ func testAccCheckIBMEnSlackDestinationConfig(instanceName, name, description str description = "%s" config { params { + type = "incoming_webhook" url = "https://hooks.slack.com/services/G0gyhsush/TYodsjhs/GHTbfidsimkk" } } diff --git a/ibm/service/eventnotification/resource_ibm_en_subscription_slack.go b/ibm/service/eventnotification/resource_ibm_en_subscription_slack.go index dfed133ac0..52e6fe7703 100644 --- a/ibm/service/eventnotification/resource_ibm_en_subscription_slack.go +++ b/ibm/service/eventnotification/resource_ibm_en_subscription_slack.go @@ -69,6 +69,25 @@ func ResourceIBMEnSlackSubscription() *schema.Resource { Optional: true, Description: "The templete id for notification", }, + "channels": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Description: "List of channels.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "channel id.", + }, + "operation": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The channel operation type. The values are add/remove", + }, + }, + }, + }, }, }, }, @@ -235,7 +254,10 @@ func resourceIBMEnSlackSubscriptionUpdate(context context.Context, d *schema.Res options.SetDescription(d.Get("description").(string)) } - _, attributes := slackattributesMapToAttributes(d.Get("attributes.0").(map[string]interface{})) + attributes, err := resourceIBMEnSubscriptionMapToSubscriptionUpdateAttributes(d.Get("attributes.0").(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } options.SetAttributes(&attributes) _, response, err := enClient.UpdateSubscriptionWithContext(context, options) @@ -279,19 +301,72 @@ func resourceIBMEnSlackSubscriptionDelete(context context.Context, d *schema.Res return nil } -func slackattributesMapToAttributes(attributeMap map[string]interface{}) (en.SubscriptionCreateAttributes, en.SubscriptionUpdateAttributesSlackAttributes) { - attributesCreate := en.SubscriptionCreateAttributes{} - attributesUpdate := en.SubscriptionUpdateAttributesSlackAttributes{} +func slackattributesMapToAttributes(modelMap map[string]interface{}) (en.SubscriptionCreateAttributes, error) { + model := en.SubscriptionCreateAttributes{} + + if modelMap["template_id_notification"] != nil && modelMap["template_id_notification"].(string) != "" { + model.TemplateIDNotification = core.StringPtr(modelMap["template_id_notification"].(string)) + } + if modelMap["template_id_invitation"] != nil && modelMap["template_id_invitation"].(string) != "" { + model.TemplateIDInvitation = core.StringPtr(modelMap["template_id_invitation"].(string)) + } + + if modelMap["attachment_color"] != nil && modelMap["attachment_color"].(string) != "" { + model.AttachmentColor = core.StringPtr(modelMap["attachment_color"].(string)) + } + if modelMap["channels"] != nil { + channels := []en.ChannelCreateAttributes{} + for _, channelsItem := range modelMap["channels"].([]interface{}) { + channelsItemModel, err := resourceIBMEnSubscriptionMapToChannelCreateAttributes(channelsItem.(map[string]interface{})) + if err != nil { + return model, err + } + channels = append(channels, *channelsItemModel) + } + model.Channels = channels + } + return model, nil +} + +func resourceIBMEnSubscriptionMapToChannelCreateAttributes(modelMap map[string]interface{}) (*en.ChannelCreateAttributes, error) { + model := &en.ChannelCreateAttributes{} + model.ID = core.StringPtr(modelMap["id"].(string)) + return model, nil +} + +func resourceIBMEnSubscriptionMapToSubscriptionUpdateAttributes(modelMap map[string]interface{}) (en.SubscriptionUpdateAttributes, error) { + model := en.SubscriptionUpdateAttributes{} - if attributeMap["attachment_color"] != nil { - attributesCreate.AttachmentColor = core.StringPtr(attributeMap["attachment_color"].(string)) - attributesUpdate.AttachmentColor = core.StringPtr(attributeMap["attachment_color"].(string)) + if modelMap["template_id_notification"] != nil && modelMap["template_id_notification"].(string) != "" { + model.TemplateIDNotification = core.StringPtr(modelMap["template_id_notification"].(string)) } - if attributeMap["template_id_notification"] != nil { - attributesCreate.TemplateIDNotification = core.StringPtr(attributeMap["template_id_notification"].(string)) - attributesUpdate.TemplateIDNotification = core.StringPtr(attributeMap["template_id_notification"].(string)) + if modelMap["attachment_color"] != nil && modelMap["attachment_color"].(string) != "" { + model.AttachmentColor = core.StringPtr(modelMap["attachment_color"].(string)) } + if modelMap["channels"] != nil { + channels := []en.ChannelUpdateAttributes{} + for _, channelsItem := range modelMap["channels"].([]interface{}) { + channelsItemModel, err := resourceIBMEnSubscriptionMapToChannelUpdateAttributes(channelsItem.(map[string]interface{})) + if err != nil { + return model, err + } + channels = append(channels, *channelsItemModel) + } + model.Channels = channels + } + return model, nil +} + +func resourceIBMEnSubscriptionChannelCreateAttributesToMap(model *en.ChannelCreateAttributes) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["id"] = model.ID + return modelMap, nil +} - return attributesCreate, attributesUpdate +func resourceIBMEnSubscriptionMapToChannelUpdateAttributes(modelMap map[string]interface{}) (*en.ChannelUpdateAttributes, error) { + model := &en.ChannelUpdateAttributes{} + model.ID = core.StringPtr(modelMap["id"].(string)) + model.Operation = core.StringPtr(modelMap["operation"].(string)) + return model, nil } diff --git a/ibm/service/eventnotification/resource_ibm_en_subscription_slack_test.go b/ibm/service/eventnotification/resource_ibm_en_subscription_slack_test.go index 56275ad5a5..6cb77dbf2b 100644 --- a/ibm/service/eventnotification/resource_ibm_en_subscription_slack_test.go +++ b/ibm/service/eventnotification/resource_ibm_en_subscription_slack_test.go @@ -85,7 +85,8 @@ func testAccCheckIBMEnSlackSubscriptionConfig(instanceName, name, description st description = "tf_destinatios_description_0364" config { params { - "url = "https://hooks.slack.com/services/G0gyhsush/TYodsjhs/GHTbfidsimkk"" + type = "incoming_webhook" + url = "https://hooks.slack.com/services/G0gyhsush/TYodsjhs/GHTbfidsimkk" } } } diff --git a/website/docs/d/en_destination_slack.html.markdown b/website/docs/d/en_destination_slack.html.markdown index 44c4e4eede..a534fc3e5b 100644 --- a/website/docs/d/en_destination_slack.html.markdown +++ b/website/docs/d/en_destination_slack.html.markdown @@ -52,6 +52,8 @@ In addition to all argument references listed, you can access the following attr Nested scheme for **params**: + - `type` - (String) The type of slack destination. The supported values are incoming_webhook and direct_message - `url` - (String) Slack Webhook url. + - `token`- (String) Token of slack application - `updated_at` - (String) Last updated time. diff --git a/website/docs/d/en_subscription_slack.html.markdown b/website/docs/d/en_subscription_slack.html.markdown index 9702c90df6..3fa73022f5 100644 --- a/website/docs/d/en_subscription_slack.html.markdown +++ b/website/docs/d/en_subscription_slack.html.markdown @@ -50,5 +50,7 @@ In addition to all argument references listed, you can access the following attr - `attributes` - (Required, List) - `attachment_color` - (String) The color code for slack attachment . + - `template_id_notification` - (String) The templete id for notification + - `channels` - (List) List of channels - `updated_at` - (String) Last updated time. diff --git a/website/docs/r/en_destination_slack.html.markdown b/website/docs/r/en_destination_slack.html.markdown index c7b3cd8ce5..8c9f36c649 100644 --- a/website/docs/r/en_destination_slack.html.markdown +++ b/website/docs/r/en_destination_slack.html.markdown @@ -12,6 +12,8 @@ Create, update, or delete a Slack destination by using IBM Cloud™ Event Notifi ## Example usage +Destination example for Slack destination type `incoming_webhook` + ```terraform resource "ibm_en_destination_slack" "slack_en_destination" { instance_guid = ibm_resource_instance.en_terraform_test_resource.guid @@ -21,12 +23,29 @@ resource "ibm_en_destination_slack" "slack_en_destination" { description = "Destination slack for event notification" config { params { + type = "incoming_webhook" url = "https://hooks.slack.com/services/G0gyhsush/TYodsjhs/GHTbfidsimkk" } } } ``` +Destination example for Slack destination type `direct_message` +```terraform +resource "ibm_en_destination_slack" "slack_en_destination" { + instance_guid = ibm_resource_instance.en_terraform_test_resource.guid + name = "My Slack Destination" + type = "slack" + collect_failed_events = false + description = "Destination slack for event notification" + config { + params { + type = "direct_message" + url = "dveufewldfwefewlfdweckewweldewfdewd" + } +} +} +``` ## Argument reference Review the argument reference that you can specify for your resource. @@ -49,7 +68,10 @@ Review the argument reference that you can specify for your resource. Nested scheme for **params**: - - `url` - (Required, String) Slack Webhook url. + - `type` - (Required, String) The Slack destination type. The supported type are incoming_webhook and direct_message + - `url` - (Optional, String) Slack Webhook url. + - `token` - (Optional, String) Token of slack application. + ## Attribute reference In addition to all argument references listed, you can access the following attribute references after your resource is created. diff --git a/website/docs/r/en_subscription_slack.html.markdown b/website/docs/r/en_subscription_slack.html.markdown index 87bd032dca..e47ba0e45e 100644 --- a/website/docs/r/en_subscription_slack.html.markdown +++ b/website/docs/r/en_subscription_slack.html.markdown @@ -12,6 +12,24 @@ Create, update, or delete a slack subscription by using IBM Cloud™ Event Notif ## Example usage +Subscription example for Slack Destination type `incoming_webhook` + +```terraform +resource "ibm_en_subscription_slack" "slack_subscription" { + instance_guid = ibm_resource_instance.en_terraform_test_resource.guid + name = "My Slack subscription" + description = "The Slack subscription for slack destination in Event Notifications" + destination_id = ibm_en_destination_slack.destination1.destination_id + topic_id = ibm_en_topic.topic1.topic_id + attributes { + attachment_color = "#FF0000" + template_id_notification = "e40843c8-hgft-4717-8ee4-f923f2786a34" + } +} +``` + +Subscription Create example for Slack Destination type `direct_message` + ```terraform resource "ibm_en_subscription_slack" "slack_subscription" { instance_guid = ibm_resource_instance.en_terraform_test_resource.guid @@ -20,7 +38,35 @@ resource "ibm_en_subscription_slack" "slack_subscription" { destination_id = ibm_en_destination_slack.destination1.destination_id topic_id = ibm_en_topic.topic1.topic_id attributes { - "attachment_color" = "#FF0000" + channels{ + id = "GHUIIIJBBBV" + } + channels{ + id = "TFDDDERRRV" + } + template_id_notification = "e40843c8-hgft-4717-8ee4-f923f2786a34" + } +} +``` + +Subscription Update example for Slack Destination type `direct_message` + +```terraform +resource "ibm_en_subscription_slack" "slack_subscription" { + instance_guid = ibm_resource_instance.en_terraform_test_resource.guid + name = "My Slack subscription" + description = "The Slack subscription for slack destination in Event Notifications" + destination_id = ibm_en_destination_slack.destination1.destination_id + topic_id = ibm_en_topic.topic1.topic_id + attributes { + channels{ + id = "GHUIIIJBBBV" + operation = "remove" + } + channels{ + id = "GGYEXCGHHUU" + operation = "add" + } template_id_notification = "e40843c8-hgft-4717-8ee4-f923f2786a34" } } @@ -47,6 +93,11 @@ Review the argument reference that you can specify for your resource. - `attachment_color` - (Optional, String) The color code for slack attachment. - `template_id_notification` - (Optional, String) The templete id for notification. + + - `channels` - (Optional, List) - List of channels . Channel attributes are + + - `id` - (Required, String)channel id + - `operation` - (Optional, String)The channel operation type . Required in case of slack subscription update. ## Attribute reference In addition to all argument references listed, you can access the following attribute references after your resource is created. diff --git a/website/docs/r/en_topic.html.markdown b/website/docs/r/en_topic.html.markdown index dff19479e6..f427a125c5 100644 --- a/website/docs/r/en_topic.html.markdown +++ b/website/docs/r/en_topic.html.markdown @@ -17,6 +17,15 @@ resource "ibm_en_topic" "en_topic" { instance_guid = ibm_resource_instance.en_terraform_test_resource.guid name = "e2e topic" description = "Topic for EN events routing" + sources { + id = ibm_resource_instance.cloud_logs_instance.crn + + rules { + enabled = true + event_type_filter = "$.*" + notification_filter = "$.data.alert_definition.name == '[${var.environment}]'" + } + } } ``` @@ -38,7 +47,7 @@ Review the argument reference that you can specify for your resource. - `rules` - (Required, List) List of rules. Nested scheme for **rules**: - - `enabled` - (Required, Boolean) Whether the rule is enabled or not. The default value is `true`. + - `enabled` - (Boolean) Whether the rule is enabled or not. The default value is `true`. - `event_type_filter` - (Required, String) Event type filter. The default value is `$.*`. The maximum length is `255`characters. The minimum length is`3`characters. The value must match regular expression`/[a-zA-Z 0-9-_$.=']_/`.