|
| 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 | +``` |
0 commit comments