@@ -48,20 +48,23 @@ var (
4848 }
4949
5050 MonitoringAlarmRepresentation = map [string ]interface {}{
51- "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
52- "destinations" : acctest.Representation {RepType : acctest .Required , Create : []string {`${oci_ons_notification_topic.test_notification_topic.id}` }, Update : []string {`${oci_ons_notification_topic.test_notification_topic2.id}` }},
53- "display_name" : acctest.Representation {RepType : acctest .Required , Create : `High CPU Utilization` , Update : `displayName2` },
54- "is_enabled" : acctest.Representation {RepType : acctest .Required , Create : `false` , Update : `true` },
55- "metric_compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
56- "namespace" : acctest.Representation {RepType : acctest .Required , Create : `oci_computeagent` , Update : `oci_lbaas` },
57- "query" : acctest.Representation {RepType : acctest .Required , Create : `CpuUtilization[10m].percentile(0.9) < 85` , Update : `AcceptedConnections[10m].count() <= 0` },
58- "severity" : acctest.Representation {RepType : acctest .Required , Create : `WARNING` , Update : `INFO` },
59- "body" : acctest.Representation {RepType : acctest .Optional , Create : `CPU utilization has reached high values.` , Update : `body2` },
60- "defined_tags" : acctest.Representation {RepType : acctest .Optional , Create : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}` , Update : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}` },
61- "freeform_tags" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"Department" : "Finance" }, Update : map [string ]string {"Department" : "Accounting" }},
51+ "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
52+ "destinations" : acctest.Representation {RepType : acctest .Required , Create : []string {`${oci_ons_notification_topic.test_notification_topic.id}` }, Update : []string {`${oci_ons_notification_topic.test_notification_topic2.id}` }},
53+ "display_name" : acctest.Representation {RepType : acctest .Required , Create : `High CPU Utilization` , Update : `displayName2` },
54+ "is_enabled" : acctest.Representation {RepType : acctest .Required , Create : `false` , Update : `true` },
55+ "metric_compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
56+ "namespace" : acctest.Representation {RepType : acctest .Required , Create : `oci_computeagent` , Update : `oci_lbaas` },
57+ "query" : acctest.Representation {RepType : acctest .Required , Create : `CpuUtilization[10m].percentile(0.9) < 85` , Update : `AcceptedConnections[10m].count() <= 0` },
58+ "severity" : acctest.Representation {RepType : acctest .Required , Create : `WARNING` , Update : `INFO` },
59+ "alarm_summary" : acctest.Representation {RepType : acctest .Optional , Create : `test summary with severity = {{severity}} and query = {{{query}}}` , Update : `alarmSummary2` },
60+ "body" : acctest.Representation {RepType : acctest .Optional , Create : `CPU utilization has reached high values.` , Update : `body2` },
61+ "defined_tags" : acctest.Representation {RepType : acctest .Optional , Create : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}` , Update : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}` },
62+ "evaluation_slack_duration" : acctest.Representation {RepType : acctest .Optional , Create : `PT5M` , Update : `PT10M` },
63+ "freeform_tags" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"Department" : "Finance" }, Update : map [string ]string {"Department" : "Accounting" }},
6264 "is_notifications_per_metric_dimension_enabled" : acctest.Representation {RepType : acctest .Required , Create : `true` , Update : `true` },
6365 "message_format" : acctest.Representation {RepType : acctest .Optional , Create : `ONS_OPTIMIZED` , Update : `PRETTY_JSON` },
6466 "metric_compartment_id_in_subtree" : acctest.Representation {RepType : acctest .Optional , Create : `false` , Update : `true` },
67+ "notification_title" : acctest.Representation {RepType : acctest .Optional , Create : `Sample title with severity {{severity}}` , Update : `notificationTitle2` },
6568 "notification_version" : acctest.Representation {RepType : acctest .Optional , Create : `1.X` , Update : `2.X` },
6669 "overrides" : []acctest.RepresentationGroup {{RepType : acctest .Optional , Group : MonitoringAlarmOverrideRepresentation1 }, {RepType : acctest .Optional , Group : MonitoringAlarmOverrideRepresentation2 }},
6770 "pending_duration" : acctest.Representation {RepType : acctest .Optional , Create : `PT5M` , Update : `PT10M` },
@@ -155,10 +158,12 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
155158 Config : config + compartmentIdVariableStr + MonitoringAlarmResourceDependencies +
156159 acctest .GenerateResourceFromRepresentationMap ("oci_monitoring_alarm" , "test_alarm" , acctest .Optional , acctest .Create , MonitoringAlarmRepresentation ),
157160 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
161+ resource .TestCheckResourceAttr (resourceName , "alarm_summary" , "test summary with severity = {{severity}} and query = {{{query}}}" ),
158162 resource .TestCheckResourceAttr (resourceName , "body" , "CPU utilization has reached high values." ),
159163 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
160164 resource .TestCheckResourceAttr (resourceName , "destinations.#" , "1" ),
161165 resource .TestCheckResourceAttr (resourceName , "display_name" , "High CPU Utilization" ),
166+ resource .TestCheckResourceAttr (resourceName , "evaluation_slack_duration" , "PT5M" ),
162167 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
163168 resource .TestCheckResourceAttrSet (resourceName , "id" ),
164169 resource .TestCheckResourceAttr (resourceName , "is_enabled" , "false" ),
@@ -167,6 +172,7 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
167172 resource .TestCheckResourceAttrSet (resourceName , "metric_compartment_id" ),
168173 resource .TestCheckResourceAttr (resourceName , "metric_compartment_id_in_subtree" , "false" ),
169174 resource .TestCheckResourceAttr (resourceName , "namespace" , "oci_computeagent" ),
175+ resource .TestCheckResourceAttr (resourceName , "notification_title" , "Sample title with severity {{severity}}" ),
170176 resource .TestCheckResourceAttr (resourceName , "notification_version" , "1.X" ),
171177 resource .TestCheckResourceAttr (resourceName , "overrides.#" , "2" ),
172178 resource .TestCheckResourceAttr (resourceName , "overrides.0.body" , "90% CPU utilization." ),
@@ -214,10 +220,12 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
214220 "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id_for_update}` },
215221 })),
216222 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
223+ resource .TestCheckResourceAttr (resourceName , "alarm_summary" , "test summary with severity = {{severity}} and query = {{{query}}}" ),
217224 resource .TestCheckResourceAttr (resourceName , "body" , "CPU utilization has reached high values." ),
218225 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentIdU ),
219226 resource .TestCheckResourceAttr (resourceName , "destinations.#" , "1" ),
220227 resource .TestCheckResourceAttr (resourceName , "display_name" , "High CPU Utilization" ),
228+ resource .TestCheckResourceAttr (resourceName , "evaluation_slack_duration" , "PT5M" ),
221229 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
222230 resource .TestCheckResourceAttrSet (resourceName , "id" ),
223231 resource .TestCheckResourceAttr (resourceName , "is_enabled" , "false" ),
@@ -226,6 +234,7 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
226234 resource .TestCheckResourceAttrSet (resourceName , "metric_compartment_id" ),
227235 resource .TestCheckResourceAttr (resourceName , "metric_compartment_id_in_subtree" , "false" ),
228236 resource .TestCheckResourceAttr (resourceName , "namespace" , "oci_computeagent" ),
237+ resource .TestCheckResourceAttr (resourceName , "notification_title" , "Sample title with severity {{severity}}" ),
229238 resource .TestCheckResourceAttr (resourceName , "notification_version" , "1.X" ),
230239 resource .TestCheckResourceAttr (resourceName , "overrides.#" , "2" ),
231240 resource .TestCheckResourceAttr (resourceName , "overrides.0.body" , "90% CPU utilization." ),
@@ -264,10 +273,12 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
264273 acctest .GenerateResourceFromRepresentationMap ("oci_monitoring_alarm" , "test_alarm" , acctest .Optional ,
265274 acctest .Update , MonitoringAlarmRepresentation ),
266275 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
276+ resource .TestCheckResourceAttr (resourceName , "alarm_summary" , "alarmSummary2" ),
267277 resource .TestCheckResourceAttr (resourceName , "body" , "body2" ),
268278 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
269279 resource .TestCheckResourceAttr (resourceName , "destinations.#" , "1" ),
270280 resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName2" ),
281+ resource .TestCheckResourceAttr (resourceName , "evaluation_slack_duration" , "PT10M" ),
271282 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
272283 resource .TestCheckResourceAttrSet (resourceName , "id" ),
273284 resource .TestCheckResourceAttr (resourceName , "is_enabled" , "true" ),
@@ -276,6 +287,7 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
276287 resource .TestCheckResourceAttrSet (resourceName , "metric_compartment_id" ),
277288 resource .TestCheckResourceAttr (resourceName , "metric_compartment_id_in_subtree" , "true" ),
278289 resource .TestCheckResourceAttr (resourceName , "namespace" , "oci_lbaas" ),
290+ resource .TestCheckResourceAttr (resourceName , "notification_title" , "notificationTitle2" ),
279291 resource .TestCheckResourceAttr (resourceName , "notification_version" , "2.X" ),
280292 resource .TestCheckResourceAttr (resourceName , "overrides.#" , "2" ),
281293 resource .TestCheckResourceAttr (resourceName , "overrides.0.body" , "95% CPU utilization." ),
@@ -324,15 +336,18 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
324336 resource .TestCheckResourceAttr (datasourceName , "state" , "ACTIVE" ),
325337
326338 resource .TestCheckResourceAttr (datasourceName , "alarms.#" , "1" ),
339+ resource .TestCheckResourceAttr (datasourceName , "alarms.0.alarm_summary" , "alarmSummary2" ),
327340 resource .TestCheckResourceAttr (datasourceName , "alarms.0.compartment_id" , compartmentId ),
328341 resource .TestCheckResourceAttr (datasourceName , "alarms.0.destinations.#" , "1" ),
329342 resource .TestCheckResourceAttr (datasourceName , "alarms.0.display_name" , "displayName2" ),
343+ resource .TestCheckResourceAttr (datasourceName , "alarms.0.evaluation_slack_duration" , "PT10M" ),
330344 resource .TestCheckResourceAttr (datasourceName , "alarms.0.freeform_tags.%" , "1" ),
331345 resource .TestCheckResourceAttrSet (datasourceName , "alarms.0.id" ),
332346 resource .TestCheckResourceAttr (datasourceName , "alarms.0.is_enabled" , "true" ),
333347 resource .TestCheckResourceAttr (datasourceName , "alarms.0.is_notifications_per_metric_dimension_enabled" , "true" ),
334348 resource .TestCheckResourceAttrSet (datasourceName , "alarms.0.metric_compartment_id" ),
335349 resource .TestCheckResourceAttr (datasourceName , "alarms.0.namespace" , "oci_lbaas" ),
350+ resource .TestCheckResourceAttr (datasourceName , "alarms.0.notification_title" , "notificationTitle2" ),
336351 resource .TestCheckResourceAttr (datasourceName , "alarms.0.notification_version" , "2.X" ),
337352 resource .TestCheckResourceAttr (datasourceName , "alarms.0.overrides.#" , "2" ),
338353 resource .TestCheckResourceAttr (datasourceName , "alarms.0.overrides.0.body" , "95% CPU utilization." ),
@@ -359,17 +374,20 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
359374 resource .TestCheckResourceAttrSet (singularDatasourceName , "alarm_id" ),
360375 resource .TestCheckResourceAttrSet (singularDatasourceName , "metric_compartment_id" ),
361376
377+ resource .TestCheckResourceAttr (singularDatasourceName , "alarm_summary" , "alarmSummary2" ),
362378 resource .TestCheckResourceAttr (singularDatasourceName , "body" , "body2" ),
363379 resource .TestCheckResourceAttr (singularDatasourceName , "compartment_id" , compartmentId ),
364380 resource .TestCheckResourceAttr (singularDatasourceName , "destinations.#" , "1" ),
365381 resource .TestCheckResourceAttr (singularDatasourceName , "display_name" , "displayName2" ),
382+ resource .TestCheckResourceAttr (singularDatasourceName , "evaluation_slack_duration" , "PT10M" ),
366383 resource .TestCheckResourceAttr (singularDatasourceName , "freeform_tags.%" , "1" ),
367384 resource .TestCheckResourceAttrSet (singularDatasourceName , "id" ),
368385 resource .TestCheckResourceAttr (singularDatasourceName , "is_enabled" , "true" ),
369386 resource .TestCheckResourceAttr (singularDatasourceName , "is_notifications_per_metric_dimension_enabled" , "true" ),
370387 resource .TestCheckResourceAttr (singularDatasourceName , "message_format" , "PRETTY_JSON" ),
371388 resource .TestCheckResourceAttr (singularDatasourceName , "metric_compartment_id_in_subtree" , "true" ),
372389 resource .TestCheckResourceAttr (singularDatasourceName , "namespace" , "oci_lbaas" ),
390+ resource .TestCheckResourceAttr (singularDatasourceName , "notification_title" , "notificationTitle2" ),
373391 resource .TestCheckResourceAttr (singularDatasourceName , "notification_version" , "2.X" ),
374392 resource .TestCheckResourceAttr (singularDatasourceName , "overrides.#" , "2" ),
375393 resource .TestCheckResourceAttr (singularDatasourceName , "overrides.1.body" , "99% CPU utilization." ),
0 commit comments