diff --git a/docs/index.md b/docs/index.md index ff3a0ff..42274e3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,7 +1,7 @@ --- page_title: "TowerOps Provider" description: |- - The TowerOps provider allows you to manage TowerOps resources such as sites and devices. + The TowerOps provider allows you to manage TowerOps resources such as sites, devices, on-call schedules, and escalation policies. --- # TowerOps Provider @@ -101,6 +101,22 @@ resource "towerops_device" "modern_switch" { } ``` +### On-Call Schedule and Escalation Policy + +```terraform +resource "towerops_schedule" "primary" { + name = "Primary On-Call" + timezone = "America/Chicago" + description = "Main engineering on-call rotation" +} + +resource "towerops_escalation_policy" "critical" { + name = "Critical Alerts" + description = "Escalation for P1 incidents" + repeat_count = 5 +} +``` + ## Schema ### Required diff --git a/docs/resources/escalation_policy.md b/docs/resources/escalation_policy.md new file mode 100644 index 0000000..a482a7f --- /dev/null +++ b/docs/resources/escalation_policy.md @@ -0,0 +1,53 @@ +--- +page_title: "towerops_escalation_policy Resource - TowerOps" +description: |- + Manages a TowerOps escalation policy. +--- + +# towerops_escalation_policy (Resource) + +Manages a TowerOps escalation policy. Escalation policies define how alerts are routed through a series of notification rules when they are not acknowledged. + +## Example Usage + +### Basic Escalation Policy + +```terraform +resource "towerops_escalation_policy" "default" { + name = "Default Escalation" +} +``` + +### Escalation Policy with Custom Repeat Count + +```terraform +resource "towerops_escalation_policy" "critical" { + name = "Critical Alerts" + description = "Escalation for P1 incidents" + repeat_count = 5 +} +``` + +## Schema + +### Required + +- `name` (String) - The name of the escalation policy. + +### Optional + +- `description` (String) - A description of the escalation policy. +- `repeat_count` (Number) - Number of times to repeat the escalation cycle. Defaults to `3`. + +### Read-Only + +- `id` (String) - The unique identifier of the escalation policy. +- `inserted_at` (String) - The timestamp when the escalation policy was created. + +## Import + +Escalation policies can be imported using their UUID: + +```shell +terraform import towerops_escalation_policy.example 550e8400-e29b-41d4-a716-446655440000 +``` diff --git a/docs/resources/schedule.md b/docs/resources/schedule.md new file mode 100644 index 0000000..e8e2e2d --- /dev/null +++ b/docs/resources/schedule.md @@ -0,0 +1,54 @@ +--- +page_title: "towerops_schedule Resource - TowerOps" +description: |- + Manages a TowerOps on-call schedule. +--- + +# towerops_schedule (Resource) + +Manages a TowerOps on-call schedule. Schedules define rotation layers that determine who is on-call at any given time. + +## Example Usage + +### Basic Schedule + +```terraform +resource "towerops_schedule" "primary" { + name = "Primary On-Call" + timezone = "America/Chicago" +} +``` + +### Schedule with Description + +```terraform +resource "towerops_schedule" "after_hours" { + name = "After-Hours Rotation" + timezone = "America/New_York" + description = "Coverage for nights and weekends" +} +``` + +## Schema + +### Required + +- `name` (String) - The name of the on-call schedule. +- `timezone` (String) - The timezone for the schedule (e.g. `America/Chicago`, `UTC`). + +### Optional + +- `description` (String) - A description of the schedule. + +### Read-Only + +- `id` (String) - The unique identifier of the schedule. +- `inserted_at` (String) - The timestamp when the schedule was created. + +## Import + +Schedules can be imported using their UUID: + +```shell +terraform import towerops_schedule.example 550e8400-e29b-41d4-a716-446655440000 +``` diff --git a/examples/main.tf b/examples/main.tf index 5d2fcc0..9170a43 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -50,6 +50,20 @@ resource "towerops_device" "access_switch" { snmp_enabled = true } +# Create an on-call schedule +resource "towerops_schedule" "primary" { + name = "Primary On-Call" + timezone = "America/Chicago" + description = "Main engineering on-call rotation" +} + +# Create an escalation policy +resource "towerops_escalation_policy" "default" { + name = "Default Escalation" + description = "Standard escalation for all alerts" + repeat_count = 3 +} + # Output the site ID output "site_id" { value = towerops_site.main_office.id @@ -58,3 +72,11 @@ output "site_id" { output "router_id" { value = towerops_device.core_router.id } + +output "schedule_id" { + value = towerops_schedule.primary.id +} + +output "escalation_policy_id" { + value = towerops_escalation_policy.default.id +} diff --git a/examples/resources/towerops_escalation_policy/resource.tf b/examples/resources/towerops_escalation_policy/resource.tf new file mode 100644 index 0000000..9321311 --- /dev/null +++ b/examples/resources/towerops_escalation_policy/resource.tf @@ -0,0 +1,5 @@ +resource "towerops_escalation_policy" "critical" { + name = "Critical Alerts" + description = "Escalation for P1 incidents" + repeat_count = 5 +} diff --git a/examples/resources/towerops_schedule/resource.tf b/examples/resources/towerops_schedule/resource.tf new file mode 100644 index 0000000..70483bf --- /dev/null +++ b/examples/resources/towerops_schedule/resource.tf @@ -0,0 +1,5 @@ +resource "towerops_schedule" "primary" { + name = "Primary On-Call" + timezone = "America/Chicago" + description = "Main engineering on-call rotation" +}