Skip to content

Commit 292f76d

Browse files
authored
Fix bugs alerts, grafana dashboards (#164)
* default type json * fix grafana dashboards bud * remove git secrets workflow
1 parent f340aa0 commit 292f76d

File tree

7 files changed

+24
-41
lines changed

7 files changed

+24
-41
lines changed

.github/workflows/git-secrets.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: https://github.com/cycodehq-public/cycode-cli
3+
rev: 0.1.6
4+
hooks:
5+
- id: cycode
6+
language_version: python3
7+
stages:
8+
- commit

docs/resources/alert_v2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ resource "logzio_alert_v2" "my_alert" {
7878
* `notification_emails` - (String list) Array of email addresses to be notified when the alert triggers.
7979
* `alert_notification_endpoints` - (Integer list) Array of IDs of pre-configured endpoint channels to notify when the alert triggers.
8080
* `suppress_notifications_minutes` - (Integer) Defaults to 5. Add a waiting period in minutes to space out notifications. (The alert will still trigger but will not send out notifications during the waiting period.)
81-
* `output_type` - (String) Selects the output format for the alert notification. Can be: `"JSON"` or `"TABLE""` If the alert has no aggregations/group by fields, JSON offers the option to send full sample logs without selecting specific fields.
81+
* `output_type` - (String) Selects the output format for the alert notification. Can be: `"JSON"` or `"TABLE""` If the alert has no aggregations/group by fields, JSON offers the option to send full sample logs without selecting specific fields. Defaults to `JSON`.
8282
* `correlation_operator` - (String) Comma separated string of supported operators. Only applicable when multiple sub-components are in use. Selects a logic for correlating the alert’s sub-components. `AND` is currently the only supported operator. When AND is the correlation_operator, both sub-components must meet their triggering criteria for the alert to trigger.
8383
* `joins` - (Map list) Specifies which group by fields must have the same values to trigger the alert. Joins the group by fields from the first and second sub-components. The key represents the index of the sub component in the array. The fields must be ordered pairs of the group by fields already in use in the `sub_components.query_string`.
8484
* `schedule_cron_expression` - (String) Cron job for the intervals schedule.

logzio/resource_alert_v2.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ func resourceAlertV2() *schema.Resource {
124124
Type: schema.TypeString,
125125
Optional: true,
126126
ValidateFunc: utils.ValidateOutputType,
127+
Default: alerts_v2.OutputTypeJson,
127128
},
128129
alertV2SubComponents: {
129130
Type: schema.TypeList,

logzio/resource_grafana_dashboard.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ func getCreateUpdateGrafanaDashboardFromSchema(d *schema.ResourceData) (grafana_
212212
var dashboardObject map[string]interface{}
213213
var payload grafana_dashboards.CreateUpdatePayload
214214

215-
for _, key := range grafanaDashboardsFieldsToDelete {
216-
delete(dashboardObject, key)
217-
}
218-
219215
err := json.Unmarshal([]byte(d.Get(grafanaDashboardJson).(string)), &dashboardObject)
220216
if err != nil {
221217
return payload, err
222218
}
223219

220+
for _, key := range grafanaDashboardsFieldsToDelete {
221+
delete(dashboardObject, key)
222+
}
223+
224224
payload = grafana_dashboards.CreateUpdatePayload{
225225
FolderUid: d.Get(grafanaDashboardFolderUid).(string),
226226
Message: d.Get(grafanaDashboardMessage).(string),
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"title": "_terraform_provider_test",
33
"uid": "_terraform_provider_test",
4-
"panels": []
4+
"panels": [],
5+
"id": 123456
56
}

readme.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,22 @@ terraform import logzio_subaccount.my_subaccount <SUBACCOUNT-ID>
195195

196196
### Changelog
197197

198+
- **v1.13.2**:
199+
- **alerts v2**:
200+
- **Bug fix**: Add default value of `JSON` to `output_type` to match API behaviour.
201+
- **grafana dashboards**:
202+
- **Bug fix**: Handle dashboard configs with id and version fields.
198203
- **v1.13.1**:
199204
- **s3 fetcher**:
200205
- **Bug fix**: `prefix` field now being applied.
201-
- **v1.13.0**:
202-
- Upgrade `logzio_client_terraform` to `1.16.0`.
203-
- Support [Grafana Dashboards API](https://docs.logz.io/api/#operation/createDashboard).
204206

205207

206208
<details>
207209
<summary markdown="span"> Expand to check old versions </summary>
208210

211+
- **v1.13.0**:
212+
- Upgrade `logzio_client_terraform` to `1.16.0`.
213+
- Support [Grafana Dashboards API](https://docs.logz.io/api/#operation/createDashboard).
209214
- **v1.12.0**:
210215
- Upgrade `logzio_client_terraform` to `1.15.0`.
211216
- Support [S3 Fetcher API](https://docs.logz.io/api/#tag/Connect-to-S3-Buckets).

0 commit comments

Comments
 (0)