Skip to content

Commit 8912e3d

Browse files
4689:Setup for Threshold TF provider (#2348)
* 4689:Setup for Threshold TF provider * 4689:removing v2 * 4689:v2 working version * 4689:v2 working version * 4689:v2 working version * 4689: Updated go client version * 4689: addressing small things from my review * 4689: adding more test * 4689: adding delete endpoint * 4689: deletion supports both paths * 4689: updating go client for asserts * 4689: fixing spacing * 4689: adding more test * 4689: fixing test --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 2fc11ea commit 8912e3d

19 files changed

+936
-23
lines changed

docs/resources/asserts_custom_model_rules.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
# generated by https://github.com/hashicorp/terraform-plugin-docs
33
page_title: "grafana_asserts_custom_model_rules Resource - terraform-provider-grafana"
4-
subcategory: "Asserts"
4+
subcategory: "Knowledge Graph"
55
description: |-
6-
Manages Asserts Custom Model Rules through the Grafana API.
6+
Manages Knowledge Graph Custom Model Rules through the Grafana API.
77
---
88

99
# grafana_asserts_custom_model_rules (Resource)
1010

11-
Manages Asserts Custom Model Rules through the Grafana API.
11+
Manages Knowledge Graph Custom Model Rules through the Grafana API.
1212

1313
## Example Usage
1414

docs/resources/asserts_log_config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
# generated by https://github.com/hashicorp/terraform-plugin-docs
33
page_title: "grafana_asserts_log_config Resource - terraform-provider-grafana"
4-
subcategory: "Asserts"
4+
subcategory: "Knowledge Graph"
55
description: |-
6-
Manages Asserts Log Configuration through Grafana API.
6+
Manages Knowledge Graph Log Configuration through Grafana API.
77
---
88

99
# grafana_asserts_log_config (Resource)
1010

11-
Manages Asserts Log Configuration through Grafana API.
11+
Manages Knowledge Graph Log Configuration through Grafana API.
1212

1313
## Example Usage
1414

docs/resources/asserts_notification_alerts_config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
# generated by https://github.com/hashicorp/terraform-plugin-docs
33
page_title: "grafana_asserts_notification_alerts_config Resource - terraform-provider-grafana"
4-
subcategory: "Asserts"
4+
subcategory: "Knowledge Graph"
55
description: |-
6-
Manages Asserts Alert Configurations through Grafana API.
6+
Manages Knowledge Graph Alert Configurations through Grafana API.
77
---
88

99
# grafana_asserts_notification_alerts_config (Resource)
1010

11-
Manages Asserts Alert Configurations through Grafana API.
11+
Manages Knowledge Graph Alert Configurations through Grafana API.
1212

1313
## Example Usage
1414

docs/resources/asserts_suppressed_assertions_config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
# generated by https://github.com/hashicorp/terraform-plugin-docs
33
page_title: "grafana_asserts_suppressed_assertions_config Resource - terraform-provider-grafana"
4-
subcategory: "Asserts"
4+
subcategory: "Knowledge Graph"
55
description: |-
6-
Manages Asserts Disabled Alert Configurations through Grafana API.
6+
Manages Knowledge Graph Disabled Alert Configurations through Grafana API.
77
---
88

99
# grafana_asserts_suppressed_assertions_config (Resource)
1010

11-
Manages Asserts Disabled Alert Configurations through Grafana API.
11+
Manages Knowledge Graph Disabled Alert Configurations through Grafana API.
1212

1313
## Example Usage
1414

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "grafana_asserts_thresholds Resource - terraform-provider-grafana"
4+
subcategory: "Knowledge Graph"
5+
description: |-
6+
Manages Knowledge Graph Thresholds configuration (request, resource, health) via bulk endpoints.
7+
---
8+
9+
# grafana_asserts_thresholds (Resource)
10+
11+
Manages Knowledge Graph Thresholds configuration (request, resource, health) via bulk endpoints.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "grafana_asserts_thresholds" "basic" {
17+
request_thresholds = [{
18+
entity_name = "payment-service"
19+
assertion_name = "ErrorRatioBreach"
20+
request_type = "inbound"
21+
request_context = "/charge"
22+
value = 0.01
23+
}]
24+
25+
resource_thresholds = [{
26+
assertion_name = "Saturation"
27+
resource_type = "container"
28+
container_name = "worker"
29+
source = "metrics"
30+
severity = "warning"
31+
value = 75
32+
}]
33+
34+
health_thresholds = [{
35+
assertion_name = "ServiceDown"
36+
expression = "up < 1"
37+
entity_type = "Service"
38+
}]
39+
}
40+
```
41+
42+
<!-- schema generated by tfplugindocs -->
43+
## Schema
44+
45+
### Optional
46+
47+
- `health_thresholds` (Block List) List of health thresholds. (see [below for nested schema](#nestedblock--health_thresholds))
48+
- `request_thresholds` (Block List) List of request thresholds. (see [below for nested schema](#nestedblock--request_thresholds))
49+
- `resource_thresholds` (Block List) List of resource thresholds. (see [below for nested schema](#nestedblock--resource_thresholds))
50+
51+
### Read-Only
52+
53+
- `id` (String) The ID of this resource.
54+
55+
<a id="nestedblock--health_thresholds"></a>
56+
### Nested Schema for `health_thresholds`
57+
58+
Required:
59+
60+
- `assertion_name` (String) Assertion name.
61+
- `entity_type` (String) Entity type for the health threshold (e.g., Service, Pod, Namespace, Volume).
62+
- `expression` (String) Prometheus expression.
63+
64+
Optional:
65+
66+
- `alert_category` (String) Optional alert category label for the health threshold.
67+
68+
69+
<a id="nestedblock--request_thresholds"></a>
70+
### Nested Schema for `request_thresholds`
71+
72+
Required:
73+
74+
- `assertion_name` (String) Assertion name (e.g., RequestRateAnomaly, ErrorRatioBreach).
75+
- `entity_name` (String) Entity name the threshold applies to.
76+
- `request_context` (String) Request context (e.g., path or context identifier).
77+
- `request_type` (String) Request type (e.g., inbound/outbound).
78+
- `value` (Number) Threshold value.
79+
80+
81+
<a id="nestedblock--resource_thresholds"></a>
82+
### Nested Schema for `resource_thresholds`
83+
84+
Required:
85+
86+
- `assertion_name` (String) Assertion name (e.g., Saturation, ResourceRateBreach).
87+
- `container_name` (String) Container name.
88+
- `resource_type` (String) Resource type (e.g., container/pod/node).
89+
- `severity` (String) Severity (warning or critical).
90+
- `source` (String) Data source for the threshold (e.g., metrics/logs).
91+
- `value` (Number) Threshold value.
92+
93+
## Import
94+
95+
Import is supported using the following syntax:
96+
97+
```shell
98+
terraform import grafana_asserts_thresholds.name "{{ id }}"
99+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import grafana_asserts_thresholds.name "{{ id }}"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
resource "grafana_asserts_thresholds" "basic" {
2+
request_thresholds = [{
3+
entity_name = "payment-service"
4+
assertion_name = "ErrorRatioBreach"
5+
request_type = "inbound"
6+
request_context = "/charge"
7+
value = 0.01
8+
}]
9+
10+
resource_thresholds = [{
11+
assertion_name = "Saturation"
12+
resource_type = "container"
13+
container_name = "worker"
14+
source = "metrics"
15+
severity = "warning"
16+
value = 75
17+
}]
18+
19+
health_thresholds = [{
20+
assertion_name = "ServiceDown"
21+
expression = "up < 1"
22+
entity_type = "Service"
23+
}]
24+
}

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/grafana/authlib/claims v0.0.0-20250120084028-e3328c576437
1313
github.com/grafana/fleet-management-api v1.0.0
1414
github.com/grafana/grafana-app-sdk v0.45.0
15-
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250916172812-b0f2b75c0d34
15+
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20251014094449-86b1bd3db812
1616
github.com/grafana/grafana-com-public-clients/go/gcom v0.0.0-20250526074454-7ec66e02e4bb
1717
github.com/grafana/grafana-openapi-client-go v0.0.0-20250617151817-c0f8cbb88d5c
1818
github.com/grafana/grafana/apps/alerting/alertenrichment v0.0.0-20250925121631-89b988ca553e
@@ -54,6 +54,8 @@ require (
5454
k8s.io/client-go v0.34.1
5555
)
5656

57+
require github.com/evanw/esbuild v0.25.10
58+
5759
require (
5860
cuelang.org/go v0.11.1 // indirect
5961
dario.cat/mergo v1.0.1 // indirect
@@ -80,7 +82,6 @@ require (
8082
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
8183
github.com/elazarl/goproxy v1.7.2 // indirect
8284
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
83-
github.com/evanw/esbuild v0.25.10 // indirect
8485
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
8586
github.com/getkin/kin-openapi v0.133.0 // indirect
8687
github.com/go-logr/logr v1.4.3 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ github.com/grafana/grafana-app-sdk v0.45.0 h1:niFqYovxuw9vnUB9qoxEgmupqriG7Gns9Z
179179
github.com/grafana/grafana-app-sdk v0.45.0/go.mod h1:1pYGEBrgG8i6pKmmsNXvtAr15jZ4iLtyHU4yj7T6XaI=
180180
github.com/grafana/grafana-app-sdk/logging v0.43.2 h1:rIWp/KSrFfedrrOl/XlOzL2mA+dhjbXlRq/wu79A54g=
181181
github.com/grafana/grafana-app-sdk/logging v0.43.2/go.mod h1:Gh/nBWnspK3oDNWtiM5qUF/fardHzOIEez+SPI3JeHA=
182-
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250916172812-b0f2b75c0d34 h1:HDMrX9/0+imwxhdhV11d0yQ8kM+2SSV4nXykZkCB1AY=
183-
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250916172812-b0f2b75c0d34/go.mod h1:piOOzeZUPg0tP4sfe1y+MFp5+jGVPri4WOVV4oSJS30=
182+
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20251014094449-86b1bd3db812 h1:U09VZk8e7XLmrgUr6/AAmWhs8yexWQxPh+EZ3Gfv318=
183+
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20251014094449-86b1bd3db812/go.mod h1:piOOzeZUPg0tP4sfe1y+MFp5+jGVPri4WOVV4oSJS30=
184184
github.com/grafana/grafana-com-public-clients/go/gcom v0.0.0-20250526074454-7ec66e02e4bb h1:rmYEnCXHNQbRsuzc5jCX5qkBqFF37c5RCHlyqAAPJZo=
185185
github.com/grafana/grafana-com-public-clients/go/gcom v0.0.0-20250526074454-7ec66e02e4bb/go.mod h1:sYWkB3NhyirQJfy3wtNQ29UYjoHbRlJlYhqN1jNsC5g=
186186
github.com/grafana/grafana-openapi-client-go v0.0.0-20250617151817-c0f8cbb88d5c h1:jox7J0BnJmcZJp8lp631u4gjDEoIfpi6O3yrpiXNTtg=

internal/common/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var (
2626
CategoryConnections ResourceCategory = "Connections"
2727
CategoryFleetManagement ResourceCategory = "Fleet Management"
2828
CategoryFrontendO11y ResourceCategory = "Frontend Observability"
29-
CategoryAsserts ResourceCategory = "Asserts"
29+
CategoryAsserts ResourceCategory = "Knowledge Graph"
3030
CategoryK6 ResourceCategory = "k6"
3131
)
3232

0 commit comments

Comments
 (0)