-
-
Save tratnayake/779fec920613b79a94609436a198a457 to your computer and use it in GitHub Desktop.
pd_terraform_example_old
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
resource "pagerduty_schedule" "myteam_schedule" { | |
name = "My Team" | |
time_zone = "America/Los_Angeles" | |
description = "PD Schedule for My Team, Slack #my-team, Email: my-team@company.com" | |
layer { | |
name = "weekday" | |
rotation_turn_length_seconds = 1209600 | |
rotation_virtual_start = "2023-01-1T09:00:00-08:00" | |
start = "2023-01-1T09:00:00-08:00" | |
users = [ | |
pagerduty_user.thilina_ratnayake.id, | |
pagerduty_user.teammate_a.id, | |
pagerduty_user.teammate_c.id, | |
pagerduty_user.teammate_b.id, | |
] | |
} | |
} | |
resource "pagerduty_escalation_policy" "myteam_escalation" { | |
name = "My Team's escalation policy for all services owned by My-Team" | |
num_loops = 9 | |
# First Notify | |
rule { | |
target { | |
type = "schedule_reference" | |
id = pagerduty_schedule.myteam_schedule.id | |
} | |
escalation_delay_in_minutes = 10 # How long to wait before escalating | |
} | |
# Escalate if not ack'd | |
rule { | |
target { | |
type = "schedule_reference" | |
id = pagerduty_schedule.otherteam_schedule.id | |
} | |
} | |
} | |
resource "pagerduty_service" "my-service-prod" { | |
name = "My-Service PROD" | |
escalation_policy = pagerduty_escalation_policy.myteam_escalation.id | |
} | |
resource "pagerduty_team" "my_team_subteam_a" { | |
name = "my-team-subteam-a" | |
description = "This is only used for UI goruping" | |
} | |
resource "pagerduty_team" "my_team_subteam_b" { | |
name = "my-team-subteam-a" | |
description = "This is only used for UI goruping" | |
} | |
resource "pagerduty_team_membership" "my_team_subteam_a_thilina" { | |
user_id = pagerduty_user.thilina_ratnayake.id | |
team_id = pagerduty_team.my-team-subteam-a.id | |
} | |
resource "pagerduty_team_membership" "my_team_subteam_a_teammate_a" { | |
user_id = pagerduty_user.teammate_a | |
team_id = pagerduty_team.my_team_subteam_b.id | |
} | |
resource "pagerduty_team_membership" "my_team_subteam_b_teammate_b" { | |
user_id = pagerduty_user.teammate_b | |
team_id = pagerduty_team.my_team_subteam_a.id | |
} | |
resource "pagerduty_team_membership" "my_team_subteam_a_teammate_c" { | |
user_id = pagerduty_user.teammate_c | |
team_id = pagerduty_team.my_team_subteam_a.id | |
} | |
resource "pagerduty_team_membership" "my_team_subteam_a_teammate_d" { | |
user_id = pagerduty_user.teammate_d.id | |
team_id = pagerduty_team.my_team_subteam_b.id | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment