diff --git a/.github/workflows/git-secrets.yml b/.github/workflows/git-secrets.yml deleted file mode 100644 index a9564d4..0000000 --- a/.github/workflows/git-secrets.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: git-secrets -# Controls when the workflow will run -# Triggers the workflow on push or pull request events but only for the main branch -on: [push] -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "main" - git-secrets: - # The type of runner that the job will run on - runs-on: ubuntu-22.04 - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - name: Check Out Source Code - uses: actions/checkout@v3 - - name: Set up Python 3.8 - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - name: Installing dependencies - run: - sudo apt-get install less openssh-server - - name: Installing scanning tool - run: | - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - ln -s "$(which echo)" /usr/local/bin/say - brew install git-secrets - git secrets --install - git secrets --register-aws - - name: Running scanning tool - run: - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - git secrets --scan diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..43ca4a7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: + - repo: https://github.com/cycodehq-public/cycode-cli + rev: 0.1.6 + hooks: + - id: cycode + language_version: python3 + stages: + - commit diff --git a/docs/resources/alert_v2.md b/docs/resources/alert_v2.md index 629db58..c581403 100644 --- a/docs/resources/alert_v2.md +++ b/docs/resources/alert_v2.md @@ -78,7 +78,7 @@ resource "logzio_alert_v2" "my_alert" { * `notification_emails` - (String list) Array of email addresses to be notified when the alert triggers. * `alert_notification_endpoints` - (Integer list) Array of IDs of pre-configured endpoint channels to notify when the alert triggers. * `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.) -* `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. +* `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`. * `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. * `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`. * `schedule_cron_expression` - (String) Cron job for the intervals schedule. diff --git a/logzio/resource_alert_v2.go b/logzio/resource_alert_v2.go index ea20146..91f4d2e 100644 --- a/logzio/resource_alert_v2.go +++ b/logzio/resource_alert_v2.go @@ -124,6 +124,7 @@ func resourceAlertV2() *schema.Resource { Type: schema.TypeString, Optional: true, ValidateFunc: utils.ValidateOutputType, + Default: alerts_v2.OutputTypeJson, }, alertV2SubComponents: { Type: schema.TypeList, diff --git a/logzio/resource_grafana_dashboard.go b/logzio/resource_grafana_dashboard.go index 76b037b..34e8825 100644 --- a/logzio/resource_grafana_dashboard.go +++ b/logzio/resource_grafana_dashboard.go @@ -212,15 +212,15 @@ func getCreateUpdateGrafanaDashboardFromSchema(d *schema.ResourceData) (grafana_ var dashboardObject map[string]interface{} var payload grafana_dashboards.CreateUpdatePayload - for _, key := range grafanaDashboardsFieldsToDelete { - delete(dashboardObject, key) - } - err := json.Unmarshal([]byte(d.Get(grafanaDashboardJson).(string)), &dashboardObject) if err != nil { return payload, err } + for _, key := range grafanaDashboardsFieldsToDelete { + delete(dashboardObject, key) + } + payload = grafana_dashboards.CreateUpdatePayload{ FolderUid: d.Get(grafanaDashboardFolderUid).(string), Message: d.Get(grafanaDashboardMessage).(string), diff --git a/logzio/testdata/fixtures/grafana_dashboard/create.json b/logzio/testdata/fixtures/grafana_dashboard/create.json index e0498e3..00a2d39 100644 --- a/logzio/testdata/fixtures/grafana_dashboard/create.json +++ b/logzio/testdata/fixtures/grafana_dashboard/create.json @@ -1,5 +1,6 @@ { "title": "_terraform_provider_test", "uid": "_terraform_provider_test", - "panels": [] + "panels": [], + "id": 123456 } \ No newline at end of file diff --git a/readme.md b/readme.md index 1b0573b..86821b8 100644 --- a/readme.md +++ b/readme.md @@ -195,17 +195,22 @@ terraform import logzio_subaccount.my_subaccount ### Changelog +- **v1.13.2**: + - **alerts v2**: + - **Bug fix**: Add default value of `JSON` to `output_type` to match API behaviour. + - **grafana dashboards**: + - **Bug fix**: Handle dashboard configs with id and version fields. - **v1.13.1**: - **s3 fetcher**: - **Bug fix**: `prefix` field now being applied. -- **v1.13.0**: - - Upgrade `logzio_client_terraform` to `1.16.0`. - - Support [Grafana Dashboards API](https://docs.logz.io/api/#operation/createDashboard).
Expand to check old versions +- **v1.13.0**: + - Upgrade `logzio_client_terraform` to `1.16.0`. + - Support [Grafana Dashboards API](https://docs.logz.io/api/#operation/createDashboard). - **v1.12.0**: - Upgrade `logzio_client_terraform` to `1.15.0`. - Support [S3 Fetcher API](https://docs.logz.io/api/#tag/Connect-to-S3-Buckets).