Skip to content

Commit 8b815e2

Browse files
author
Joey Orlando
authored
docs: update docs around referencing teams in grafana_oncall_* resources (#2163)
* docs: update docs around referencing teams in `grafana_oncall_*` resources * `go generate` output * `terraform fmt -recursive && go generate ./...` output
1 parent 3bae8a2 commit 8b815e2

File tree

17 files changed

+159
-17
lines changed

17 files changed

+159
-17
lines changed

docs/data-sources/oncall_team.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16-
data "grafana_oncall_team" "example_team" {
17-
name = "example_team"
16+
data "grafana_team" "my_team" {
17+
name = "my team"
18+
}
19+
20+
data "grafana_oncall_team" "my_team" {
21+
name = data.grafana_team.my_team.name
1822
}
1923
```
2024

docs/resources/oncall_escalation_chain.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,20 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16+
data "grafana_team" "my_team" {
17+
name = "my team"
18+
}
19+
20+
data "grafana_oncall_team" "my_team" {
21+
name = data.grafana_team.my_team.name
22+
}
23+
1624
resource "grafana_oncall_escalation_chain" "default" {
1725
provider = grafana.oncall
1826
name = "default"
27+
28+
// Optional: specify the team to which the escalation chain belongs
29+
team_id = data.grafana_oncall_team.my_team.id
1930
}
2031
```
2132

@@ -28,7 +39,7 @@ resource "grafana_oncall_escalation_chain" "default" {
2839

2940
### Optional
3041

31-
- `team_id` (String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource.
42+
- `team_id` (String) The ID of the OnCall team (using the `grafana_oncall_team` datasource).
3243

3344
### Read-Only
3445

docs/resources/oncall_integration.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@ description: |-
1414
## Example Usage
1515

1616
```terraform
17+
data "grafana_team" "my_team" {
18+
name = "my team"
19+
}
20+
21+
data "grafana_oncall_team" "my_team" {
22+
name = data.grafana_team.my_team.name
23+
}
24+
1725
resource "grafana_oncall_integration" "test-acc-integration" {
1826
provider = grafana.oncall
1927
name = "my integration"
2028
type = "grafana"
29+
30+
// Optional: specify the team to which the integration belongs
31+
team_id = data.grafana_oncall_team.my_team.id
32+
2133
default_route {
2234
}
2335
}
@@ -28,6 +40,10 @@ resource "grafana_oncall_integration" "integration_with_templates" {
2840
provider = grafana.oncall
2941
name = "integration_with_templates"
3042
type = "webhook"
43+
44+
// Optional: specify the team to which the integration belongs
45+
team_id = data.grafana_oncall_team.my_team.id
46+
3147
default_route {
3248
}
3349
templates {
@@ -56,7 +72,7 @@ resource "grafana_oncall_integration" "integration_with_templates" {
5672
### Optional
5773

5874
- `labels` (List of Map of String) A list of string-to-string mappings. Each map must include one key named "key" and one key named "value".
59-
- `team_id` (String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource.
75+
- `team_id` (String) The ID of the OnCall team (using the `grafana_oncall_team` datasource).
6076
- `templates` (Block List, Max: 1) Jinja2 templates for Alert payload. An empty templates block will be ignored. (see [below for nested schema](#nestedblock--templates))
6177

6278
### Read-Only

docs/resources/oncall_on_call_shift.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ data "grafana_oncall_user" "alex" {
1717
username = "alex"
1818
}
1919
20+
data "grafana_team" "my_team" {
21+
name = "my team"
22+
}
23+
24+
data "grafana_oncall_team" "my_team" {
25+
name = data.grafana_team.my_team.name
26+
}
27+
2028
resource "grafana_oncall_on_call_shift" "example_shift" {
2129
name = "Example Shift"
2230
type = "recurrent_event"
@@ -30,6 +38,9 @@ resource "grafana_oncall_on_call_shift" "example_shift" {
3038
data.grafana_oncall_user.alex.id
3139
]
3240
time_zone = "UTC"
41+
42+
// Optional: specify the team to which the on-call shift belongs
43+
team_id = data.grafana_oncall_team.my_team.id
3344
}
3445
3546
////////
@@ -81,6 +92,9 @@ resource "grafana_oncall_on_call_shift" "emea_weekday_shift" {
8192
local.teams_map_of_user_id.emea,
8293
]) : [k]]
8394
start_rotation_from_user_index = 0
95+
96+
// Optional: specify the team to which the on-call shift belongs
97+
team_id = data.grafana_oncall_team.my_team.id
8498
}
8599
86100
output "emea_weekday__rolling_users" {
@@ -108,7 +122,7 @@ output "emea_weekday__rolling_users" {
108122
- `level` (Number) The priority level. The higher the value, the higher the priority.
109123
- `rolling_users` (List of Set of String) The list of lists with on-call users (for rolling_users event type)
110124
- `start_rotation_from_user_index` (Number) The index of the list of users in rolling_users, from which on-call rotation starts.
111-
- `team_id` (String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource.
125+
- `team_id` (String) The ID of the OnCall team (using the `grafana_oncall_team` datasource).
112126
- `time_zone` (String) The shift's timezone. Overrides schedule's timezone.
113127
- `until` (String) The end time of recurrent on-call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00")
114128
- `users` (Set of String) The list of on-call users (for single_event and recurrent_event event type).

docs/resources/oncall_outgoing_webhook.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,21 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16+
data "grafana_team" "my_team" {
17+
name = "my team"
18+
}
19+
20+
data "grafana_oncall_team" "my_team" {
21+
name = data.grafana_team.my_team.name
22+
}
23+
1624
resource "grafana_oncall_outgoing_webhook" "test-acc-outgoing_webhook" {
1725
provider = grafana.oncall
1826
name = "my outgoing webhook"
1927
url = "https://example.com/"
28+
29+
// Optional: specify the team to which the outgoing webhook belongs
30+
team_id = data.grafana_oncall_team.my_team.id
2031
}
2132
```
2233

@@ -38,7 +49,7 @@ resource "grafana_oncall_outgoing_webhook" "test-acc-outgoing_webhook" {
3849
- `integration_filter` (List of String) Restricts the outgoing webhook to only trigger if the event came from a selected integration. If no integrations are selected the outgoing webhook will trigger for any integration.
3950
- `is_webhook_enabled` (Boolean) Controls whether the outgoing webhook will trigger or is ignored. Defaults to `true`.
4051
- `password` (String, Sensitive) The auth data of the webhook. Used for Basic authentication
41-
- `team_id` (String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource.
52+
- `team_id` (String) The ID of the OnCall team (using the `grafana_oncall_team` datasource).
4253
- `trigger_template` (String) A template used to dynamically determine whether the webhook should execute based on the content of the payload.
4354
- `trigger_type` (String) The type of event that will cause this outgoing webhook to execute. The types of triggers are: `escalation`, `alert group created`, `acknowledge`, `resolve`, `silence`, `unsilence`, `unresolve`, `unacknowledge`. Defaults to `escalation`.
4455
- `user` (String) Username to use when making the outgoing webhook request.

docs/resources/oncall_schedule.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,24 @@ data "grafana_oncall_user_group" "example_user_group" {
2020
slack_handle = "example_slack_handle"
2121
}
2222
23+
data "grafana_team" "my_team" {
24+
name = "my team"
25+
}
26+
27+
data "grafana_oncall_team" "my_team" {
28+
name = data.grafana_team.my_team.name
29+
}
2330
2431
// ICal based schedule
2532
resource "grafana_oncall_schedule" "example_schedule" {
2633
name = "Example Ical Schadule"
2734
type = "ical"
2835
ical_url_primary = "https://example.com/example_ical.ics"
2936
ical_url_overrides = "https://example.com/example_overrides_ical.ics"
37+
38+
// Optional: specify the team to which the schedule belongs
39+
team_id = data.grafana_oncall_team.my_team.id
40+
3041
slack {
3142
channel_id = data.grafana_oncall_slack_channel.example_slack_channel.slack_id
3243
user_group_id = data.grafana_oncall_user_group.example_user_group.slack_id
@@ -38,6 +49,10 @@ resource "grafana_oncall_schedule" "example_schedule" {
3849
name = "Example Calendar Schadule"
3950
type = "calendar"
4051
time_zone = "America/New_York"
52+
53+
// Optional: specify the team to which the schedule belongs
54+
team_id = data.grafana_oncall_team.my_team.id
55+
4156
shifts = [
4257
]
4358
ical_url_overrides = "https://example.com/example_overrides_ical.ics"
@@ -59,7 +74,7 @@ resource "grafana_oncall_schedule" "example_schedule" {
5974
- `ical_url_primary` (String) The URL of the external calendar iCal file.
6075
- `shifts` (Set of String) The list of ID's of on-call shifts.
6176
- `slack` (Block List, Max: 1) The Slack-specific settings for a schedule. (see [below for nested schema](#nestedblock--slack))
62-
- `team_id` (String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource.
77+
- `team_id` (String) The ID of the OnCall team (using the `grafana_oncall_team` datasource).
6378
- `time_zone` (String) The schedule's time zone.
6479

6580
### Read-Only
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
data "grafana_oncall_team" "example_team" {
2-
name = "example_team"
3-
}
1+
data "grafana_team" "my_team" {
2+
name = "my team"
3+
}
4+
5+
data "grafana_oncall_team" "my_team" {
6+
name = data.grafana_team.my_team.name
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
data "grafana_team" "my_team" {
2+
name = "my team"
3+
}
4+
5+
data "grafana_oncall_team" "my_team" {
6+
name = data.grafana_team.my_team.name
7+
}
8+
19
resource "grafana_oncall_escalation_chain" "default" {
210
provider = grafana.oncall
311
name = "default"
12+
13+
// Optional: specify the team to which the escalation chain belongs
14+
team_id = data.grafana_oncall_team.my_team.id
415
}

examples/resources/grafana_oncall_integration/resource.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1+
data "grafana_team" "my_team" {
2+
name = "my team"
3+
}
4+
5+
data "grafana_oncall_team" "my_team" {
6+
name = data.grafana_team.my_team.name
7+
}
8+
19
resource "grafana_oncall_integration" "test-acc-integration" {
210
provider = grafana.oncall
311
name = "my integration"
412
type = "grafana"
13+
14+
// Optional: specify the team to which the integration belongs
15+
team_id = data.grafana_oncall_team.my_team.id
16+
517
default_route {
618
}
719
}
@@ -12,6 +24,10 @@ resource "grafana_oncall_integration" "integration_with_templates" {
1224
provider = grafana.oncall
1325
name = "integration_with_templates"
1426
type = "webhook"
27+
28+
// Optional: specify the team to which the integration belongs
29+
team_id = data.grafana_oncall_team.my_team.id
30+
1531
default_route {
1632
}
1733
templates {

examples/resources/grafana_oncall_on_call_shift/resource.tf

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ data "grafana_oncall_user" "alex" {
22
username = "alex"
33
}
44

5+
data "grafana_team" "my_team" {
6+
name = "my team"
7+
}
8+
9+
data "grafana_oncall_team" "my_team" {
10+
name = data.grafana_team.my_team.name
11+
}
12+
513
resource "grafana_oncall_on_call_shift" "example_shift" {
614
name = "Example Shift"
715
type = "recurrent_event"
@@ -15,6 +23,9 @@ resource "grafana_oncall_on_call_shift" "example_shift" {
1523
data.grafana_oncall_user.alex.id
1624
]
1725
time_zone = "UTC"
26+
27+
// Optional: specify the team to which the on-call shift belongs
28+
team_id = data.grafana_oncall_team.my_team.id
1829
}
1930

2031
////////
@@ -66,8 +77,11 @@ resource "grafana_oncall_on_call_shift" "emea_weekday_shift" {
6677
local.teams_map_of_user_id.emea,
6778
]) : [k]]
6879
start_rotation_from_user_index = 0
80+
81+
// Optional: specify the team to which the on-call shift belongs
82+
team_id = data.grafana_oncall_team.my_team.id
6983
}
7084

7185
output "emea_weekday__rolling_users" {
7286
value = [for k in flatten(grafana_oncall_on_call_shift.emea_weekday_shift.rolling_users) : lookup(local.users_map_by_id, k).username]
73-
}
87+
}

0 commit comments

Comments
 (0)