Skip to content

Commit ef7fa57

Browse files
authored
SLO: Implements SLO Datasource and SLO Resource (#910)
Implements a SLO Datasource and a SLO Resource, supports CRUD and Import functionality.
1 parent 629fdfe commit ef7fa57

File tree

15 files changed

+1367
-3
lines changed

15 files changed

+1367
-3
lines changed

GNUmakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ golangci-lint:
6060

6161
linkcheck:
6262
docker run -it --entrypoint sh -v "$$PWD:$$PWD" -w "$$PWD" python:3.11-alpine -c "pip3 install linkchecker && linkchecker --config .linkcheckerrc docs"
63+

docs/data-sources/slos.md

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "grafana_slos Data Source - terraform-provider-grafana"
4+
subcategory: "SLO"
5+
description: |-
6+
Datasource for retrieving all SLOs.
7+
Official documentation https://grafana.com/docs/grafana-cloud/slo/API documentation https://grafana.com/docs/grafana-cloud/slo/api/
8+
---
9+
10+
# grafana_slos (Data Source)
11+
12+
Datasource for retrieving all SLOs.
13+
14+
* [Official documentation](https://grafana.com/docs/grafana-cloud/slo/)
15+
* [API documentation](https://grafana.com/docs/grafana-cloud/slo/api/)
16+
17+
## Example Usage
18+
19+
```terraform
20+
resource "grafana_slo" "test" {
21+
name = "Terraform Testing"
22+
description = "Terraform Description"
23+
query {
24+
freeform {
25+
query = "sum(rate(apiserver_request_total{code!=\"500\"}[$__rate_interval])) / sum(rate(apiserver_request_total[$__rate_interval]))"
26+
}
27+
type = "freeform"
28+
}
29+
objectives {
30+
value = 0.995
31+
window = "30d"
32+
}
33+
label {
34+
key = "custom"
35+
value = "value"
36+
}
37+
alerting {
38+
fastburn {
39+
annotation {
40+
key = "name"
41+
value = "Critical - SLO Burn Rate Alert"
42+
}
43+
label {
44+
key = "type"
45+
value = "slo"
46+
}
47+
}
48+
49+
slowburn {
50+
annotation {
51+
key = "name"
52+
value = "Warning - SLO Burn Rate Alert"
53+
}
54+
label {
55+
key = "type"
56+
value = "slo"
57+
}
58+
}
59+
}
60+
}
61+
62+
data "grafana_slos" "slos" {}
63+
```
64+
65+
<!-- schema generated by tfplugindocs -->
66+
## Schema
67+
68+
### Read-Only
69+
70+
- `id` (String) The ID of this resource.
71+
- `slos` (List of Object) Returns a list of all SLOs" (see [below for nested schema](#nestedatt--slos))
72+
73+
<a id="nestedatt--slos"></a>
74+
### Nested Schema for `slos`
75+
76+
Read-Only:
77+
78+
- `alerting` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting))
79+
- `dashboard_uid` (String)
80+
- `description` (String)
81+
- `label` (List of Object) (see [below for nested schema](#nestedobjatt--slos--label))
82+
- `name` (String)
83+
- `objectives` (List of Object) (see [below for nested schema](#nestedobjatt--slos--objectives))
84+
- `query` (List of Object) (see [below for nested schema](#nestedobjatt--slos--query))
85+
- `uuid` (String)
86+
87+
<a id="nestedobjatt--slos--alerting"></a>
88+
### Nested Schema for `slos.alerting`
89+
90+
Read-Only:
91+
92+
- `annotation` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting--annotation))
93+
- `fastburn` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting--fastburn))
94+
- `label` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting--label))
95+
- `slowburn` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting--slowburn))
96+
97+
<a id="nestedobjatt--slos--alerting--annotation"></a>
98+
### Nested Schema for `slos.alerting.annotation`
99+
100+
Read-Only:
101+
102+
- `key` (String)
103+
- `value` (String)
104+
105+
106+
<a id="nestedobjatt--slos--alerting--fastburn"></a>
107+
### Nested Schema for `slos.alerting.fastburn`
108+
109+
Read-Only:
110+
111+
- `annotation` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting--fastburn--annotation))
112+
- `label` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting--fastburn--label))
113+
114+
<a id="nestedobjatt--slos--alerting--fastburn--annotation"></a>
115+
### Nested Schema for `slos.alerting.fastburn.label`
116+
117+
Read-Only:
118+
119+
- `key` (String)
120+
- `value` (String)
121+
122+
123+
<a id="nestedobjatt--slos--alerting--fastburn--label"></a>
124+
### Nested Schema for `slos.alerting.fastburn.label`
125+
126+
Read-Only:
127+
128+
- `key` (String)
129+
- `value` (String)
130+
131+
132+
133+
<a id="nestedobjatt--slos--alerting--label"></a>
134+
### Nested Schema for `slos.alerting.label`
135+
136+
Read-Only:
137+
138+
- `key` (String)
139+
- `value` (String)
140+
141+
142+
<a id="nestedobjatt--slos--alerting--slowburn"></a>
143+
### Nested Schema for `slos.alerting.slowburn`
144+
145+
Read-Only:
146+
147+
- `annotation` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting--slowburn--annotation))
148+
- `label` (List of Object) (see [below for nested schema](#nestedobjatt--slos--alerting--slowburn--label))
149+
150+
<a id="nestedobjatt--slos--alerting--slowburn--annotation"></a>
151+
### Nested Schema for `slos.alerting.slowburn.label`
152+
153+
Read-Only:
154+
155+
- `key` (String)
156+
- `value` (String)
157+
158+
159+
<a id="nestedobjatt--slos--alerting--slowburn--label"></a>
160+
### Nested Schema for `slos.alerting.slowburn.label`
161+
162+
Read-Only:
163+
164+
- `key` (String)
165+
- `value` (String)
166+
167+
168+
169+
170+
<a id="nestedobjatt--slos--label"></a>
171+
### Nested Schema for `slos.label`
172+
173+
Read-Only:
174+
175+
- `key` (String)
176+
- `value` (String)
177+
178+
179+
<a id="nestedobjatt--slos--objectives"></a>
180+
### Nested Schema for `slos.objectives`
181+
182+
Read-Only:
183+
184+
- `value` (Number)
185+
- `window` (String)
186+
187+
188+
<a id="nestedobjatt--slos--query"></a>
189+
### Nested Schema for `slos.query`
190+
191+
Read-Only:
192+
193+
- `freeform` (List of Object) (see [below for nested schema](#nestedobjatt--slos--query--freeform))
194+
- `type` (String)
195+
196+
<a id="nestedobjatt--slos--query--freeform"></a>
197+
### Nested Schema for `slos.query.freeform`
198+
199+
Read-Only:
200+
201+
- `query` (String)
202+
203+

0 commit comments

Comments
 (0)