-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create two-level schedule feat: Create PagerDuty Escalation Policy module feat: Create PagerDuty Service module feat: Create PagerDuty Escalation Policy module feat: Create PagerDuty Service module
- Loading branch information
Showing
43 changed files
with
1,061 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
compact: true | ||
directory: | ||
- gcp-gke | ||
- . | ||
- examples | ||
- modules | ||
download-external-modules: true | ||
evaluate-variables: true | ||
external-modules-download-path: .external_modules | ||
framework: | ||
- all | ||
quiet: true | ||
skip-path: | ||
- .external_modules | ||
- modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
matches-ignore: | ||
- 3a05c7337c773d81cf59fac4de5c2082abdaf712c229f806fc10aa629bd44022 # Revoked PagerDuty token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Honest Two-level PagerDuty Schedule Example | ||
|
||
> | ||
> ⚠️ WARNING: This example can only be used to create and destroy. Modifications that result in removal of users | ||
> from the schedule and their destruction will fail due to a mismanaged dependency (PagerDuty tries to destroy the users | ||
> before removing them from the schedule/s). | ||
> | ||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_pagerduty"></a> [pagerduty](#requirement\_pagerduty) | >= 2.2 | | ||
|
||
## Providers | ||
|
||
No providers. | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_dummy_users"></a> [dummy\_users](#module\_dummy\_users) | ../../modules/pagerduty-user | n/a | | ||
| <a name="module_schedule"></a> [schedule](#module\_schedule) | ../../modules/honest-two-level-schedule | n/a | | ||
|
||
## Resources | ||
|
||
No resources. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_dummy_user_count"></a> [dummy\_user\_count](#input\_dummy\_user\_count) | The number of dummy users to create to place into rotation. | `number` | `2` | no | | ||
| <a name="input_name"></a> [name](#input\_name) | The name to set for the schedule. | `string` | n/a | yes | | ||
| <a name="input_pagerduty_token"></a> [pagerduty\_token](#input\_pagerduty\_token) | PagerDuty API token. | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_dummy_user_ids"></a> [dummy\_user\_ids](#output\_dummy\_user\_ids) | The dummy users created to be placed into rotation. | | ||
| <a name="output_level_one_schedule_id"></a> [level\_one\_schedule\_id](#output\_level\_one\_schedule\_id) | n/a | | ||
| <a name="output_level_two_schedule_id"></a> [level\_two\_schedule\_id](#output\_level\_two\_schedule\_id) | n/a | | ||
<!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name = "Acquisition Squad" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
variable "name" { | ||
description = "The name to set for the schedule." | ||
type = string | ||
} | ||
|
||
variable "pagerduty_token" { | ||
type = string | ||
description = "PagerDuty API token." | ||
} | ||
|
||
variable "dummy_user_count" { | ||
type = number | ||
default = 2 | ||
description = "The number of dummy users to create to place into rotation." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module "dummy_users" { | ||
count = var.dummy_user_count | ||
|
||
source = "../../modules/pagerduty-user" | ||
name = "pagerduty-schedule-example-user-${count.index}" | ||
email_address = "pagerduty-schedule-example-user-${count.index}@honestbank.com" | ||
} | ||
|
||
module "schedule" { | ||
source = "../../modules/honest-two-level-schedule" | ||
|
||
name = "Example - ${var.name}" | ||
description = "${var.name} - this is an example description" | ||
|
||
# 604,800 seconds = 1 week (7 days) | ||
# 86,400 seconds = 1 day | ||
rotation_turn_length_seconds = 86400 | ||
|
||
# Wednesday 5pm GMT+7 rotation handover | ||
start_datetime = "2022-07-27T17:00:00+07:00" | ||
time_zone = "Asia/Bangkok" | ||
|
||
user_ids = module.dummy_users.*.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
output "level_one_schedule_id" { | ||
value = module.schedule.level_one_schedule_id | ||
} | ||
|
||
output "level_two_schedule_id" { | ||
value = module.schedule.level_two_schedule_id | ||
} | ||
|
||
output "dummy_user_ids" { | ||
description = "The dummy users created to be placed into rotation." | ||
value = module.dummy_users.*.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
terraform { | ||
required_providers { | ||
pagerduty = { | ||
source = "pagerduty/pagerduty" | ||
version = ">= 2.2" | ||
} | ||
} | ||
|
||
experiments = [module_variable_optional_attrs] | ||
} | ||
|
||
provider "pagerduty" { | ||
token = var.pagerduty_token | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# PagerDuty Escalation Policy Example | ||
|
||
This example creates a 3-level escalation policy - an example screenshot is provided below: | ||
|
||
![img.png](example-escalation-policy-screenshot.png) | ||
|
||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_pagerduty"></a> [pagerduty](#requirement\_pagerduty) | >= 2.2 | | ||
|
||
## Providers | ||
|
||
No providers. | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_engineering_lead"></a> [engineering\_lead](#module\_engineering\_lead) | ../../modules/pagerduty-user | n/a | | ||
| <a name="module_engineering_user_one"></a> [engineering\_user\_one](#module\_engineering\_user\_one) | ../../modules/pagerduty-user | n/a | | ||
| <a name="module_engineering_user_two"></a> [engineering\_user\_two](#module\_engineering\_user\_two) | ../../modules/pagerduty-user | n/a | | ||
| <a name="module_escalation_policy"></a> [escalation\_policy](#module\_escalation\_policy) | ../../modules/pagerduty-escalation-policy | n/a | | ||
| <a name="module_level_one_engineering_schedule"></a> [level\_one\_engineering\_schedule](#module\_level\_one\_engineering\_schedule) | ../../modules/pagerduty-schedule | n/a | | ||
| <a name="module_level_three_engineering_schedule"></a> [level\_three\_engineering\_schedule](#module\_level\_three\_engineering\_schedule) | ../../modules/pagerduty-schedule | n/a | | ||
| <a name="module_level_three_product_schedule"></a> [level\_three\_product\_schedule](#module\_level\_three\_product\_schedule) | ../../modules/pagerduty-schedule | n/a | | ||
| <a name="module_level_two_engineering_schedule"></a> [level\_two\_engineering\_schedule](#module\_level\_two\_engineering\_schedule) | ../../modules/pagerduty-schedule | n/a | | ||
| <a name="module_level_two_product_schedule"></a> [level\_two\_product\_schedule](#module\_level\_two\_product\_schedule) | ../../modules/pagerduty-schedule | n/a | | ||
| <a name="module_product_lead"></a> [product\_lead](#module\_product\_lead) | ../../modules/pagerduty-user | n/a | | ||
| <a name="module_product_manager"></a> [product\_manager](#module\_product\_manager) | ../../modules/pagerduty-user | n/a | | ||
|
||
## Resources | ||
|
||
No resources. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_description"></a> [description](#input\_description) | The description to set for the schedule. | `string` | `"The description to set for the schedule."` | no | | ||
| <a name="input_escalation_delay_in_minutes"></a> [escalation\_delay\_in\_minutes](#input\_escalation\_delay\_in\_minutes) | Minutes until an incident is escalated. | `number` | `60` | no | | ||
| <a name="input_escalation_levels"></a> [escalation\_levels](#input\_escalation\_levels) | Escalation levels and targets | `any` | n/a | yes | | ||
| <a name="input_name"></a> [name](#input\_name) | The name to set for the schedule. | `string` | `"The name to set for the schedule."` | no | | ||
| <a name="input_pagerduty_token"></a> [pagerduty\_token](#input\_pagerduty\_token) | PagerDuty API token. | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_id"></a> [id](#output\_id) | n/a | | ||
<!-- END_TF_DOCS --> |
Binary file added
BIN
+171 KB
examples/pagerduty-escalation-policy/example-escalation-policy-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name = "example escalation policy" | ||
description = "description of example escalation policy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
variable "name" { | ||
default = "example escalation policy name" | ||
description = "The name to set for the schedule." | ||
type = string | ||
} | ||
|
||
variable "description" { | ||
default = "example escalation policy description" | ||
description = "The description to set for the schedule." | ||
type = string | ||
} | ||
|
||
variable "escalation_delay_in_minutes" { | ||
description = "Minutes until an incident is escalated." | ||
default = 60 | ||
} | ||
|
||
variable "escalation_levels" { | ||
default = [] | ||
description = "Escalation levels and targets" | ||
} | ||
|
||
variable "pagerduty_token" { | ||
type = string | ||
description = "PagerDuty API token." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
module "engineering_user_one" { | ||
source = "../../modules/pagerduty-user" | ||
name = "pagerduty-escalation-policy-example-engineering-user-one" | ||
email_address = "pagerduty-escalation-policy-example-engineering-user-one@honestbank.com" | ||
} | ||
|
||
module "engineering_user_two" { | ||
source = "../../modules/pagerduty-user" | ||
name = "pagerduty-escalation-policy-example-engineering-user-two" | ||
email_address = "pagerduty-escalation-policy-example-engineering-user-two@honestbank.com" | ||
} | ||
|
||
module "engineering_lead" { | ||
source = "../../modules/pagerduty-user" | ||
name = "pagerduty-escalation-policy-example-engineering-lead" | ||
email_address = "pagerduty-escalation-policy-example-engineering-lead@honestbank.com" | ||
} | ||
|
||
module "product_manager" { | ||
source = "../../modules/pagerduty-user" | ||
name = "pagerduty-escalation-policy-example-product-manager" | ||
email_address = "pagerduty-escalation-policy-example-product-manager@honestbank.com" | ||
} | ||
|
||
module "product_lead" { | ||
source = "../../modules/pagerduty-user" | ||
name = "pagerduty-escalation-policy-example-product-lead" | ||
email_address = "pagerduty-escalation-policy-example-product-lead@honestbank.com" | ||
} | ||
|
||
module "level_one_engineering_schedule" { | ||
source = "../../modules/pagerduty-schedule" | ||
|
||
description = "level one engineering schedule" | ||
name = "level one engineering schedule" | ||
|
||
# 604,800 seconds = 1 week (7 days) | ||
rotation_turn_length_seconds = 604800 | ||
|
||
# Wednesday 5pm GMT+7 rotation handover | ||
start_datetime = "2022-07-27T17:00:00+07:00" | ||
time_zone = "Asia/Bangkok" | ||
|
||
user_ids = [ | ||
module.engineering_user_one.id, | ||
module.engineering_user_two.id, | ||
] | ||
} | ||
|
||
module "level_two_engineering_schedule" { | ||
source = "../../modules/pagerduty-schedule" | ||
|
||
description = "level two engineering schedule" | ||
name = "level two engineering schedule" | ||
|
||
# 604,800 seconds = 1 week (7 days) | ||
rotation_turn_length_seconds = 604800 | ||
|
||
# Wednesday 5pm GMT+7 rotation handover | ||
start_datetime = "2022-07-27T17:00:00+07:00" | ||
time_zone = "Asia/Bangkok" | ||
|
||
user_ids = [ | ||
module.engineering_user_two.id, | ||
module.engineering_user_one.id, | ||
] | ||
} | ||
|
||
module "level_two_product_schedule" { | ||
source = "../../modules/pagerduty-schedule" | ||
|
||
description = "level two product schedule" | ||
name = "level two product schedule" | ||
|
||
# 604,800 seconds = 1 week (7 days) | ||
rotation_turn_length_seconds = 604800 | ||
|
||
# Wednesday 5pm GMT+7 rotation handover | ||
start_datetime = "2022-07-27T17:00:00+07:00" | ||
time_zone = "Asia/Bangkok" | ||
|
||
user_ids = [module.product_manager.id] | ||
} | ||
|
||
module "level_three_engineering_schedule" { | ||
source = "../../modules/pagerduty-schedule" | ||
|
||
description = "level three engineering schedule" | ||
name = "level three engineering schedule" | ||
|
||
# 604,800 seconds = 1 week (7 days) | ||
rotation_turn_length_seconds = 604800 | ||
|
||
# Wednesday 5pm GMT+7 rotation handover | ||
start_datetime = "2022-07-27T17:00:00+07:00" | ||
time_zone = "Asia/Bangkok" | ||
|
||
user_ids = [module.engineering_lead.id] | ||
} | ||
|
||
module "level_three_product_schedule" { | ||
source = "../../modules/pagerduty-schedule" | ||
|
||
description = "level three product schedule" | ||
name = "level three product schedule" | ||
|
||
# 604,800 seconds = 1 week (7 days) | ||
rotation_turn_length_seconds = 604800 | ||
|
||
# Wednesday 5pm GMT+7 rotation handover | ||
start_datetime = "2022-07-27T17:00:00+07:00" | ||
time_zone = "Asia/Bangkok" | ||
|
||
user_ids = [module.product_lead.id] | ||
} | ||
|
||
module "escalation_policy" { | ||
source = "../../modules/pagerduty-escalation-policy" | ||
|
||
name = var.name | ||
description = var.description | ||
|
||
escalation_delay_in_minutes = 60 | ||
|
||
escalation_levels = (length(var.escalation_levels) > 0 ? var.escalation_levels : [ | ||
[module.level_one_engineering_schedule.id], | ||
[module.level_two_engineering_schedule.id, module.level_two_product_schedule.id], | ||
[module.level_three_engineering_schedule.id, module.level_three_product_schedule.id], | ||
]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "id" { | ||
value = module.escalation_policy.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
terraform { | ||
required_providers { | ||
pagerduty = { | ||
source = "pagerduty/pagerduty" | ||
version = ">= 2.2" | ||
} | ||
} | ||
|
||
experiments = [module_variable_optional_attrs] | ||
} | ||
|
||
provider "pagerduty" { | ||
token = var.pagerduty_token | ||
} |
Oops, something went wrong.