Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: PC-13723 Add SHR report support #304

Merged
merged 12 commits into from
Sep 23, 2024
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ NAMESPACE=nobl9
NAME=nobl9
BIN_DIR=./bin
BINARY=$(BIN_DIR)/terraform-provider-$(NAME)
VERSION=0.29.2
VERSION=0.30.0
BUILD_FLAGS="-X github.com/nobl9/terraform-provider-nobl9/nobl9.Version=$(VERSION)"
OS_ARCH?=linux_amd64

Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The Nobl9 Provider delivers tools working with the Nobl9 API to create and manag
- Alert Methods
- Data Sources
- Role Bindings
- Reports

The Nobl9 Terraform Provider does not support the configuration of the following resources:
- [SLO Annotations](https://docs.nobl9.com/features/slo-annotations/)
Expand Down
189 changes: 189 additions & 0 deletions docs/resources/report_system_health_review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
---
page_title: "nobl9_report_system_health_review Resource - terraform-provider-nobl9"
description: |-
System Health Review Report | Nobl9 Documentation https://docs.nobl9.com/reports/system-health-review/
---

# nobl9_report_system_health_review (Resource)

The System Health Review report facilitates recurring reliability check-ins by grouping your Nobl9 SLOs by projects or services and labels of your choice through the remaining error budget metric in a table-form report.

## Example Usage

Here's an example of Error Budget Status Report resource configuration:

```terraform
resource "nobl9_report_system_health_review" "this" {
name = "my-shr-report"
display_name = "My System Health Review Report"
shared = true
row_group_by = "service"

filters {
projects = ["project1", "project2"]
service {
name = "service1"
project = "project1"
}
service {
name = "service2"
project = "project2"
}
slo {
name = "my-slo"
project = "project1"
}
label {
key = "key1"
values = ["value1"]
}
}

time_frame {
time_zone = "Europe/Warsaw"
snapshot {
point = "past"
date_time = "2024-09-05T09:58:37Z"
rrule = "FREQ=DAILY;INTERVAL=1"
}
}

column {
display_name = "Column 1"
label {
key = "key1"
values = ["value1"]
}
}

column {
display_name = "Column 2"
label {
key = "key2"
values = ["value2"]
}
}

thresholds {
red_lte = 0.8
green_gt = 0.95
show_no_data = true
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `column` (Block List, Min: 1) Columns to display in the report table. (see [below for nested schema](#nestedblock--column))
- `name` (String) Unique name of the resource, must conform to the naming convention from [DNS RFC1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
- `row_group_by` (String) Grouping methods of report table rows [project/service]
- `thresholds` (Block Set, Min: 1, Max: 1) Thresholds for Green, Yellow and Red statuses (e.g. healthy, at risk, exhausted budget). Yellow is calculated as the difference between Red and Green thresholds. If Red and Green are the same, Yellow is not used on the report. (see [below for nested schema](#nestedblock--thresholds))
- `time_frame` (Block Set, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--time_frame))

### Optional

- `display_name` (String) User-friendly display name of the resource.
- `filters` (Block List, Max: 1) Filters are used to select scope for Report. (see [below for nested schema](#nestedblock--filters))
- `shared` (Boolean) Is report shared for all users with access to included projects.

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedblock--column"></a>
### Nested Schema for `column`

Required:

- `display_name` (String) Column display name.
- `label` (Block List, Min: 1) [Labels](https://docs.nobl9.com/features/labels/) containing a single key and a list of values. (see [below for nested schema](#nestedblock--column--label))

<a id="nestedblock--column--label"></a>
### Nested Schema for `column.label`

Required:

- `key` (String) A key for the label, unique within the associated resource.
- `values` (List of String) A list of unique values for a single key.



<a id="nestedblock--thresholds"></a>
### Nested Schema for `thresholds`

Required:

- `green_gt` (Number) Min value for the Green status (e.g. healthy).
- `red_lte` (Number) Max value for the Red status (e.g. exhausted budget).

Optional:

- `show_no_data` (Boolean) ShowNoData customizes the report to either show or hide rows with no data.


<a id="nestedblock--time_frame"></a>
### Nested Schema for `time_frame`

Required:

- `snapshot` (Block Set, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--time_frame--snapshot))
- `time_zone` (String) Timezone name in IANA Time Zone Database.

<a id="nestedblock--time_frame--snapshot"></a>
### Nested Schema for `time_frame.snapshot`

Required:

- `point` (String) The method of reporting time frame [past/latest]

Optional:

- `date_time` (String) Date and time of the past snapshot in RFC3339 format.
- `rrule` (String) The recurrence rule for the report past snapshot. The expected value is a string in RRULE format. Example: `FREQ=MONTHLY;BYMONTHDAY=1`



<a id="nestedblock--filters"></a>
### Nested Schema for `filters`

Optional:

- `label` (Block List) [Labels](https://docs.nobl9.com/features/labels/) containing a single key and a list of values. (see [below for nested schema](#nestedblock--filters--label))
- `projects` (List of String) Projects to pull data for report from.
- `service` (Block List) Services to pull data for report from. (see [below for nested schema](#nestedblock--filters--service))
- `slo` (Block List) SLOs to pull data for report from. (see [below for nested schema](#nestedblock--filters--slo))

<a id="nestedblock--filters--label"></a>
### Nested Schema for `filters.label`

Required:

- `key` (String) A key for the label, unique within the associated resource.
- `values` (List of String) A list of unique values for a single key.


<a id="nestedblock--filters--service"></a>
### Nested Schema for `filters.service`

Required:

- `name` (String) Unique name of the resource, must conform to the naming convention from [DNS RFC1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
- `project` (String) Name of the Nobl9 project the resource sits in, must conform to the naming convention from [DNS RFC1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).


<a id="nestedblock--filters--slo"></a>
### Nested Schema for `filters.slo`

Required:

- `name` (String) Unique name of the resource, must conform to the naming convention from [DNS RFC1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
- `project` (String) Name of the Nobl9 project the resource sits in, must conform to the naming convention from [DNS RFC1123](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).

## Useful Links

[Reports in Nobl9 | Nobl9 Documentation](https://docs.nobl9.com/reports/)

[Reports YAML Configuration | Nobl9 Documentation](https://docs.nobl9.com/yaml-guide#report)
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
resource "nobl9_report_system_health_review" "this" {
name = "my-shr-report"
display_name = "My System Health Review Report"
shared = true
row_group_by = "service"

filters {
projects = ["project1", "project2"]
service {
name = "service1"
project = "project1"
}
service {
name = "service2"
project = "project2"
}
slo {
name = "my-slo"
project = "project1"
}
label {
key = "key1"
values = ["value1"]
}
}

time_frame {
time_zone = "Europe/Warsaw"
snapshot {
point = "past"
date_time = "2024-09-05T09:58:37Z"
rrule = "FREQ=DAILY;INTERVAL=1"
}
}

column {
display_name = "Column 1"
label {
key = "key1"
values = ["value1"]
}
}

column {
display_name = "Column 2"
label {
key = "key2"
values = ["value2"]
}
}

thresholds {
red_lte = 0.8
green_gt = 0.95
show_no_data = true
}
}

23 changes: 12 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/nobl9/nobl9-go v0.84.0
github.com/nobl9/nobl9-go v0.84.1-rc6
github.com/stretchr/testify v1.9.0
github.com/teambition/rrule-go v1.8.2
)
Expand All @@ -24,7 +24,7 @@ require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.54.17 // indirect
github.com/aws/aws-sdk-go v1.55.5 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
Expand Down Expand Up @@ -66,6 +66,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/nobl9/go-yaml v1.0.1 // indirect
github.com/nobl9/govy v0.1.1 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -79,15 +80,15 @@ require (
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.24.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
Expand Down
Loading
Loading