Skip to content

Commit 207f696

Browse files
committed
Update docs and examples
1 parent 6f01414 commit 207f696

File tree

9 files changed

+369
-1
lines changed

9 files changed

+369
-1
lines changed

docs/data-sources/k6_schedule.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "grafana_k6_schedule Data Source - terraform-provider-grafana"
4+
subcategory: "k6"
5+
description: |-
6+
Retrieves a k6 schedule.
7+
---
8+
9+
# grafana_k6_schedule (Data Source)
10+
11+
Retrieves a k6 schedule.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "grafana_k6_project" "schedule_project" {
17+
name = "Terraform Schedule Test Project"
18+
}
19+
20+
resource "grafana_k6_load_test" "schedule_load_test" {
21+
project_id = grafana_k6_project.schedule_project.id
22+
name = "Terraform Test Load Test for Schedule"
23+
script = <<-EOT
24+
export default function() {
25+
console.log('Hello from k6 schedule test!');
26+
}
27+
EOT
28+
29+
depends_on = [
30+
grafana_k6_project.schedule_project,
31+
]
32+
}
33+
34+
resource "grafana_k6_schedule" "test_schedule" {
35+
load_test_id = grafana_k6_load_test.schedule_load_test.id
36+
starts = "2024-12-25T10:00:00Z"
37+
frequency = "DAILY"
38+
interval = 1
39+
occurrences = 10
40+
41+
depends_on = [
42+
grafana_k6_load_test.schedule_load_test,
43+
]
44+
}
45+
46+
data "grafana_k6_schedule" "from_id" {
47+
id = grafana_k6_schedule.test_schedule.id
48+
}
49+
```
50+
51+
<!-- schema generated by tfplugindocs -->
52+
## Schema
53+
54+
### Required
55+
56+
- `id` (String) Numeric identifier of the schedule.
57+
58+
### Read-Only
59+
60+
- `created_by` (String) The email of the user who created the schedule.
61+
- `deactivated` (Boolean) Whether the schedule is deactivated.
62+
- `frequency` (String) The frequency of the schedule (HOURLY, DAILY, WEEKLY, MONTHLY).
63+
- `interval` (Number) The interval between each frequency iteration.
64+
- `load_test_id` (String) The identifier of the load test to schedule.
65+
- `next_run` (String) The next scheduled execution time.
66+
- `occurrences` (Number) How many times the recurrence will repeat.
67+
- `starts` (String) The start time for the schedule (RFC3339 format).
68+
- `until` (String) The end time for the recurrence (RFC3339 format).

docs/data-sources/k6_schedules.md

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_k6_schedules Data Source - terraform-provider-grafana"
4+
subcategory: "k6"
5+
description: |-
6+
Retrieves all k6 schedules.
7+
---
8+
9+
# grafana_k6_schedules (Data Source)
10+
11+
Retrieves all k6 schedules.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "grafana_k6_project" "schedules_project" {
17+
name = "Terraform Schedules Test Project"
18+
}
19+
20+
resource "grafana_k6_load_test" "schedules_load_test" {
21+
project_id = grafana_k6_project.schedules_project.id
22+
name = "Terraform Test Load Test for Schedules"
23+
script = <<-EOT
24+
export default function() {
25+
console.log('Hello from k6 schedules test!');
26+
}
27+
EOT
28+
29+
depends_on = [
30+
grafana_k6_project.schedules_project,
31+
]
32+
}
33+
34+
resource "grafana_k6_load_test" "schedules_load_test_2" {
35+
project_id = grafana_k6_project.schedules_project.id
36+
name = "Terraform Test Load Test for Schedules (2)"
37+
script = <<-EOT
38+
export default function() {
39+
console.log('Hello from k6 schedules test!');
40+
}
41+
EOT
42+
43+
depends_on = [
44+
grafana_k6_project.schedules_project,
45+
]
46+
}
47+
48+
49+
resource "grafana_k6_schedule" "test_schedule_1" {
50+
load_test_id = grafana_k6_load_test.schedules_load_test.id
51+
starts = "2024-12-25T10:00:00Z"
52+
frequency = "DAILY"
53+
interval = 1
54+
occurrences = 5
55+
56+
depends_on = [
57+
grafana_k6_load_test.schedules_load_test,
58+
]
59+
}
60+
61+
resource "grafana_k6_schedule" "test_schedule_2" {
62+
load_test_id = grafana_k6_load_test.schedules_load_test_2.id
63+
starts = "2024-12-26T14:00:00Z"
64+
frequency = "WEEKLY"
65+
interval = 2
66+
until = "2025-01-31T23:59:59Z"
67+
68+
depends_on = [
69+
grafana_k6_load_test.schedules_load_test_2,
70+
]
71+
}
72+
73+
data "grafana_k6_schedules" "from_load_test_id" {
74+
}
75+
```
76+
77+
<!-- schema generated by tfplugindocs -->
78+
## Schema
79+
80+
### Read-Only
81+
82+
- `id` (String) The identifier for this data source.
83+
- `schedules` (List of Object) (see [below for nested schema](#nestedatt--schedules))
84+
85+
<a id="nestedatt--schedules"></a>
86+
### Nested Schema for `schedules`
87+
88+
Read-Only:
89+
90+
- `created_by` (String)
91+
- `deactivated` (Boolean)
92+
- `frequency` (String)
93+
- `id` (String)
94+
- `interval` (Number)
95+
- `load_test_id` (String)
96+
- `next_run` (String)
97+
- `occurrences` (Number)
98+
- `starts` (String)
99+
- `until` (String)

docs/resources/k6_schedule.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "grafana_k6_schedule Resource - terraform-provider-grafana"
4+
subcategory: "k6"
5+
description: |-
6+
Manages a k6 schedule for automated test execution.
7+
---
8+
9+
# grafana_k6_schedule (Resource)
10+
11+
Manages a k6 schedule for automated test execution.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "grafana_k6_project" "schedule_project" {
17+
name = "Terraform Schedule Project"
18+
}
19+
20+
resource "grafana_k6_load_test" "scheduled_test" {
21+
project_id = grafana_k6_project.schedule_project.id
22+
name = "Terraform Scheduled Test"
23+
script = <<-EOT
24+
export default function() {
25+
console.log('Hello from scheduled k6 test!');
26+
}
27+
EOT
28+
}
29+
30+
resource "grafana_k6_load_test" "scheduled_test_2" {
31+
project_id = grafana_k6_project.schedule_project.id
32+
name = "Terraform Scheduled Test 2"
33+
script = <<-EOT
34+
export default function() {
35+
console.log('Hello from scheduled k6 test 2!');
36+
}
37+
EOT
38+
}
39+
40+
resource "grafana_k6_load_test" "scheduled_test_3" {
41+
project_id = grafana_k6_project.schedule_project.id
42+
name = "Terraform Scheduled Test 3"
43+
script = <<-EOT
44+
export default function() {
45+
console.log('Hello from scheduled k6 test!');
46+
}
47+
EOT
48+
}
49+
50+
# Basic schedule - runs daily at 9 AM UTC
51+
resource "grafana_k6_schedule" "daily_schedule" {
52+
load_test_id = grafana_k6_load_test.scheduled_test.id
53+
starts = "2024-01-01T09:00:00Z"
54+
frequency = "DAILY"
55+
}
56+
57+
# Advanced schedule - runs every 2 hours with occurrences limit
58+
resource "grafana_k6_schedule" "hourly_schedule" {
59+
load_test_id = grafana_k6_load_test.scheduled_test_2.id
60+
starts = "2024-01-01T08:00:00Z"
61+
frequency = "HOURLY"
62+
interval = 2
63+
occurrences = 50
64+
}
65+
66+
# Weekly schedule with end date
67+
resource "grafana_k6_schedule" "weekly_schedule" {
68+
load_test_id = grafana_k6_load_test.scheduled_test_3.id
69+
starts = "2024-01-01T14:30:00Z"
70+
frequency = "WEEKLY"
71+
until = "2024-12-31T23:59:59Z"
72+
}
73+
```
74+
75+
<!-- schema generated by tfplugindocs -->
76+
## Schema
77+
78+
### Required
79+
80+
- `frequency` (String) The frequency of the schedule (HOURLY, DAILY, WEEKLY, MONTHLY).
81+
- `load_test_id` (String) The identifier of the load test to schedule.
82+
- `starts` (String) The start time for the schedule (RFC3339 format).
83+
84+
### Optional
85+
86+
- `interval` (Number) The interval between each frequency iteration (e.g., 2 = every 2 hours for HOURLY).
87+
- `occurrences` (Number) How many times the recurrence will repeat.
88+
- `until` (String) The end time for the recurrence (RFC3339 format).
89+
90+
### Read-Only
91+
92+
- `created_by` (String) The email of the user who created the schedule.
93+
- `deactivated` (Boolean) Whether the schedule is deactivated.
94+
- `id` (String) Numeric identifier of the schedule.
95+
- `next_run` (String) The next scheduled execution time.
96+
97+
## Import
98+
99+
Import is supported using the following syntax:
100+
101+
```shell
102+
terraform import grafana_k6_schedule.name "{{ id }}"
103+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import grafana_k6_schedule.name "{{ id }}"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
resource "grafana_k6_project" "schedule_project" {
2+
name = "Terraform Schedule Project"
3+
}
4+
5+
resource "grafana_k6_load_test" "scheduled_test" {
6+
project_id = grafana_k6_project.schedule_project.id
7+
name = "Terraform Scheduled Test"
8+
script = <<-EOT
9+
export default function() {
10+
console.log('Hello from scheduled k6 test!');
11+
}
12+
EOT
13+
}
14+
15+
resource "grafana_k6_load_test" "scheduled_test_2" {
16+
project_id = grafana_k6_project.schedule_project.id
17+
name = "Terraform Scheduled Test 2"
18+
script = <<-EOT
19+
export default function() {
20+
console.log('Hello from scheduled k6 test 2!');
21+
}
22+
EOT
23+
}
24+
25+
resource "grafana_k6_load_test" "scheduled_test_3" {
26+
project_id = grafana_k6_project.schedule_project.id
27+
name = "Terraform Scheduled Test 3"
28+
script = <<-EOT
29+
export default function() {
30+
console.log('Hello from scheduled k6 test!');
31+
}
32+
EOT
33+
}
34+
35+
# Basic schedule - runs daily at 9 AM UTC
36+
resource "grafana_k6_schedule" "daily_schedule" {
37+
load_test_id = grafana_k6_load_test.scheduled_test.id
38+
starts = "2024-01-01T09:00:00Z"
39+
frequency = "DAILY"
40+
}
41+
42+
# Advanced schedule - runs every 2 hours with occurrences limit
43+
resource "grafana_k6_schedule" "hourly_schedule" {
44+
load_test_id = grafana_k6_load_test.scheduled_test_2.id
45+
starts = "2024-01-01T08:00:00Z"
46+
frequency = "HOURLY"
47+
interval = 2
48+
occurrences = 50
49+
}
50+
51+
# Weekly schedule with end date
52+
resource "grafana_k6_schedule" "weekly_schedule" {
53+
load_test_id = grafana_k6_load_test.scheduled_test_3.id
54+
starts = "2024-01-01T14:30:00Z"
55+
frequency = "WEEKLY"
56+
until = "2024-12-31T23:59:59Z"
57+
}

internal/resources/k6/catalog-data-source.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,29 @@ spec:
6363
type: terraform-data-source
6464
owner: group:default/k6-cloud-provisioning
6565
lifecycle: production
66+
---
67+
apiVersion: backstage.io/v1alpha1
68+
kind: Component
69+
metadata:
70+
name: datasource-grafana_k6_schedule
71+
title: grafana_k6_schedule (data source)
72+
description: |
73+
data source `grafana_k6_schedule` in Grafana Labs' Terraform Provider
74+
spec:
75+
subcomponentOf: component:default/terraform-provider-grafana
76+
type: terraform-data-source
77+
owner: group:default/k6-cloud-provisioning
78+
lifecycle: production
79+
---
80+
apiVersion: backstage.io/v1alpha1
81+
kind: Component
82+
metadata:
83+
name: datasource-grafana_k6_schedules
84+
title: grafana_k6_schedules (data source)
85+
description: |
86+
data source `grafana_k6_schedules` in Grafana Labs' Terraform Provider
87+
spec:
88+
subcomponentOf: component:default/terraform-provider-grafana
89+
type: terraform-data-source
90+
owner: group:default/k6-cloud-provisioning
91+
lifecycle: production

internal/resources/k6/catalog-resource.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,16 @@ spec:
3737
type: terraform-resource
3838
owner: group:default/k6-cloud-provisioning
3939
lifecycle: production
40+
---
41+
apiVersion: backstage.io/v1alpha1
42+
kind: Component
43+
metadata:
44+
name: resource-grafana_k6_schedule
45+
title: grafana_k6_schedule (resource)
46+
description: |
47+
resource `grafana_k6_schedule` in Grafana Labs' Terraform Provider
48+
spec:
49+
subcomponentOf: component:default/terraform-provider-grafana
50+
type: terraform-resource
51+
owner: group:default/k6-cloud-provisioning
52+
lifecycle: production

pkg/generate/postprocessing/replace_references.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ var knownReferences = []string{
7777
"grafana_k6_installation.stack_id=grafana_cloud_stack.id",
7878
"grafana_k6_load_test.project_id=grafana_k6_project.id",
7979
"grafana_k6_project_limits.project_id=grafana_k6_project.id",
80+
"grafana_k6_schedule.load_test_id=grafana_k6_load_test.id",
8081
"grafana_library_panel.folder_uid=grafana_folder.uid",
8182
"grafana_library_panel.org_id=grafana_organization.id",
8283
"grafana_machine_learning_alert.job_id=grafana_machine_learning_job.id",

provider_schema.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)