Skip to content

Commit 7cda59d

Browse files
authored
Merge pull request #586 from SumoLogic/SUMO-199581-timezone-in-monitor-def
SUMO-199581: timezone in monitor definition
2 parents e41f6cb + 589261c commit 7cda59d

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.28.0 (Unreleased)
2+
FEATURES:
3+
* resource/sumologic_monitor: Added support for setting `time_zone` at Monitor level for notifications content (GH-586)
4+
15
## 2.27.1 (November 14, 2023)
26
BUG FIXES:
37
* Fixes `resource_sumologic_cse_match_list` constant change when defining a match list containing a custom column using the custom columns name instead of ID (GH-591)

sumologic/resource_sumologic_monitors_library_monitor.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ func getMonitorBaseSchema() map[string]*schema.Schema {
6565
DiffSuppressFunc: SuppressEquivalentTimeDiff(false),
6666
},
6767

68+
"time_zone": {
69+
Type: schema.TypeString,
70+
Optional: true,
71+
},
72+
6873
"alert_name": {
6974
Type: schema.TypeString,
7075
Optional: true,
@@ -813,6 +818,7 @@ func resourceSumologicMonitorsLibraryMonitorRead(d *schema.ResourceData, meta in
813818
d.Set("slo_id", monitor.SloID)
814819
d.Set("notification_group_fields", monitor.NotificationGroupFields)
815820
d.Set("tags", monitor.Tags)
821+
d.Set("time_zone", monitor.TimeZone)
816822

817823
// set notifications
818824
notifications := make([]interface{}, len(monitor.Notifications))
@@ -1564,6 +1570,7 @@ func resourceToMonitorsLibraryMonitor(d *schema.ResourceData) MonitorsLibraryMon
15641570
ModifiedBy: d.Get("modified_by").(string),
15651571
IsMutable: d.Get("is_mutable").(bool),
15661572
Version: d.Get("version").(int),
1573+
TimeZone: d.Get("time_zone").(string),
15671574
Notifications: notifications,
15681575
Type: d.Get("type").(string),
15691576
ParentID: d.Get("parent_id").(string),

sumologic/resource_sumologic_monitors_library_monitor_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ func TestAccSumologicMonitorsLibraryMonitor_create(t *testing.T) {
203203
testMonitorType := "Logs"
204204
testIsDisabled := false
205205
canonicalTestEvaluationDelay := "1h"
206+
testTimeZone := "America/New_York"
206207
testQueries := []MonitorQuery{
207208
{
208209
RowID: "A",
@@ -272,6 +273,7 @@ func TestAccSumologicMonitorsLibraryMonitor_create(t *testing.T) {
272273
resource.TestCheckResourceAttr("sumologic_monitor.test", "type", testType),
273274
resource.TestCheckResourceAttr("sumologic_monitor.test", "description", testDescription),
274275
resource.TestCheckResourceAttr("sumologic_monitor.test", "evaluation_delay", canonicalTestEvaluationDelay),
276+
resource.TestCheckResourceAttr("sumologic_monitor.test", "time_zone", testTimeZone),
275277
resource.TestCheckResourceAttr("sumologic_monitor.test", "content_type", testContentType),
276278
resource.TestCheckResourceAttr("sumologic_monitor.test", "queries.0.row_id", testQueries[0].RowID),
277279
resource.TestCheckResourceAttr("sumologic_monitor.test", "triggers.0.trigger_type", testTriggers[0].TriggerType),
@@ -372,6 +374,7 @@ func TestAccSumologicMonitorsLibraryMonitor_update(t *testing.T) {
372374
testPlaybook := "This is a test playbook"
373375
testIsDisabled := false
374376
canonicalTestEvaluationDelay := "1h"
377+
testTimeZone := "America/New_York"
375378
testQueries := []MonitorQuery{
376379
{
377380
RowID: "A",
@@ -434,6 +437,7 @@ func TestAccSumologicMonitorsLibraryMonitor_update(t *testing.T) {
434437
testUpdatedPlaybook := "This is an updated test playbook"
435438
testUpdatedIsDisabled := true
436439
testUpdatedEvaluationDelay := "8m"
440+
testUpdatedTimeZone := "America/Chicago"
437441
testUpdatedQueries := []MonitorQuery{
438442
{
439443
RowID: "A",
@@ -503,6 +507,7 @@ func TestAccSumologicMonitorsLibraryMonitor_update(t *testing.T) {
503507
resource.TestCheckResourceAttr("sumologic_monitor.test", "type", testType),
504508
resource.TestCheckResourceAttr("sumologic_monitor.test", "description", testDescription),
505509
resource.TestCheckResourceAttr("sumologic_monitor.test", "evaluation_delay", canonicalTestEvaluationDelay),
510+
resource.TestCheckResourceAttr("sumologic_monitor.test", "time_zone", testTimeZone),
506511
resource.TestCheckResourceAttr("sumologic_monitor.test", "content_type", testContentType),
507512
resource.TestCheckResourceAttr("sumologic_monitor.test", "queries.0.row_id", testQueries[0].RowID),
508513
resource.TestCheckResourceAttr("sumologic_monitor.test", "triggers.0.trigger_type", testTriggers[0].TriggerType),
@@ -527,6 +532,7 @@ func TestAccSumologicMonitorsLibraryMonitor_update(t *testing.T) {
527532
resource.TestCheckResourceAttr("sumologic_monitor.test", "type", testUpdatedType),
528533
resource.TestCheckResourceAttr("sumologic_monitor.test", "description", testUpdatedDescription),
529534
resource.TestCheckResourceAttr("sumologic_monitor.test", "evaluation_delay", testUpdatedEvaluationDelay),
535+
resource.TestCheckResourceAttr("sumologic_monitor.test", "time_zone", testUpdatedTimeZone),
530536
resource.TestCheckResourceAttr("sumologic_monitor.test", "content_type", testUpdatedContentType),
531537
resource.TestCheckResourceAttr("sumologic_monitor.test", "queries.0.row_id", testUpdatedQueries[0].RowID),
532538
resource.TestCheckResourceAttr("sumologic_monitor.test", "triggers.0.trigger_type", testUpdatedTriggers[0].TriggerType),
@@ -802,6 +808,7 @@ resource "sumologic_monitor" "test" {
802808
content_type = "Monitor"
803809
monitor_type = "Logs"
804810
evaluation_delay = "60m"
811+
time_zone = "America/New_York"
805812
queries {
806813
row_id = "A"
807814
query = "_sourceCategory=monitor-manager error"
@@ -929,6 +936,7 @@ resource "sumologic_monitor" "test" {
929936
content_type = "Monitor"
930937
monitor_type = "Logs"
931938
evaluation_delay = "8m"
939+
time_zone = "America/Chicago"
932940
queries {
933941
row_id = "A"
934942
query = "_sourceCategory=monitor-manager info"
@@ -1011,6 +1019,7 @@ resource "sumologic_monitor" "test_monitor_connection" {
10111019
content_type = "Monitor"
10121020
monitor_type = "Logs"
10131021
evaluation_delay = "8m"
1022+
time_zone = "Asia/Kolkata"
10141023
queries {
10151024
row_id = "A"
10161025
query = "_sourceCategory=monitor-manager info"
@@ -1286,6 +1295,7 @@ resource "sumologic_monitor" "test" {
12861295
is_disabled = false
12871296
content_type = "Monitor"
12881297
monitor_type = "Slo"
1298+
time_zone = "America/New_York"
12891299
slo_id = sumologic_slo.slo_tf_window_metric_ratio.id
12901300
trigger_conditions {
12911301
%s

sumologic/sumologic_monitors_library_monitor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ type MonitorsLibraryMonitor struct {
150150
SloID string `json:"sloId,omitempty"`
151151
NotificationGroupFields []string `json:"notificationGroupFields,omitempty"`
152152
Tags map[string]interface{} `json:"tags"`
153+
TimeZone string `json:"timeZone,omitempty"`
153154
}
154155

155156
type MonitorQuery struct {

0 commit comments

Comments
 (0)