-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
U-4519 Manage on-call calendar rotations (#141)
- Loading branch information
Showing
12 changed files
with
340 additions
and
24 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
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ git clone https://github.com/BetterStackHQ/terraform-provider-better-uptime && \ | |
echo '# See variables.tf for more. | ||
betteruptime_api_token = "XXXXXXXXXXXXXXXXXXXXXXXX" | ||
betteruptime_secondary_calendar_name = "My secondary calendar" | ||
betteruptime_rotation_users = ["[email protected]", "[email protected]", "[email protected]"] | ||
' > terraform.tfvars | ||
|
||
terraform init | ||
|
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 |
---|---|---|
|
@@ -15,3 +15,11 @@ The name of your secondary on-call calendar. | |
EOF | ||
default = "Secondary calendar" | ||
} | ||
|
||
variable "betteruptime_rotation_users" { | ||
type = list(string) | ||
description = <<EOF | ||
Emails of users to use in new on-call rotation. | ||
EOF | ||
default = ["[email protected]", "[email protected]"] | ||
} |
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 |
---|---|---|
|
@@ -26,6 +26,8 @@ func TestOnCallCalendarData(t *testing.T) { | |
_, _ = w.Write([]byte(`{"data":[{"id":"123","attributes":{"name":"Primary","default_calendar":true},"relationships":{"on_call_users":{"data":[{"id":"123456","type":"user"}]}}}],"included":[{"id":"123456","type":"user","attributes":{"first_name":"John","last_name":"Smith","email":"[email protected]","phone_numbers":[]}}],"pagination":{"next":"..."}}`)) | ||
case r.Method == http.MethodGet && r.RequestURI == prefix+"?page=2": | ||
_, _ = w.Write([]byte(`{"data":[{"id":"456","attributes":{"name":"Secondary","default_calendar":false},"relationships":{"on_call_users":{"data":[{"id":"456789","type":"user"}]}}}],"included":[{"id":"456789","type":"user","attributes":{"first_name":"Jane","last_name":"Doe","email":"[email protected]","phone_numbers":["+44 808 157 0192"]}}],"pagination":{"next":null}}`)) | ||
case r.Method == http.MethodGet && r.RequestURI == prefix+"/456/rotation": | ||
w.WriteHeader(http.StatusNotFound) | ||
default: | ||
t.Fatal("Unexpected " + r.Method + " " + r.RequestURI) | ||
t.Fail() | ||
|
@@ -62,6 +64,7 @@ func TestOnCallCalendarData(t *testing.T) { | |
resource.TestCheckResourceAttr("data.betteruptime_on_call_calendar.this", "on_call_users.0.last_name", "Doe"), | ||
resource.TestCheckResourceAttr("data.betteruptime_on_call_calendar.this", "on_call_users.0.email", "[email protected]"), | ||
resource.TestCheckResourceAttr("data.betteruptime_on_call_calendar.this", "on_call_users.0.phone_numbers.0", "+44 808 157 0192"), | ||
resource.TestCheckResourceAttr("data.betteruptime_on_call_calendar.this", "on_call_rotation.#", "0"), | ||
), | ||
}, | ||
}, | ||
|
@@ -80,6 +83,8 @@ func TestDefaultOnCallCalendarData(t *testing.T) { | |
switch { | ||
case r.Method == http.MethodGet && r.RequestURI == "/api/v2/on-calls/default": | ||
_, _ = w.Write([]byte(`{"data":{"id":"123","attributes":{"name":"Primary","default_calendar":true},"relationships":{"on_call_users":{"data":[{"id":"123456","type":"user"}]}}},"included":[{"id":"123456","type":"user","attributes":{"first_name":"John","last_name":"Smith","email":"[email protected]","phone_numbers":[]}}]}`)) | ||
case r.Method == http.MethodGet && r.RequestURI == "/api/v2/on-calls/123/rotation": | ||
w.WriteHeader(http.StatusNotFound) | ||
default: | ||
t.Fatal("Unexpected " + r.Method + " " + r.RequestURI) | ||
t.Fail() | ||
|
@@ -112,6 +117,7 @@ func TestDefaultOnCallCalendarData(t *testing.T) { | |
resource.TestCheckResourceAttr("data.betteruptime_on_call_calendar.this", "on_call_users.0.first_name", "John"), | ||
resource.TestCheckResourceAttr("data.betteruptime_on_call_calendar.this", "on_call_users.0.last_name", "Smith"), | ||
resource.TestCheckResourceAttr("data.betteruptime_on_call_calendar.this", "on_call_users.0.email", "[email protected]"), | ||
resource.TestCheckResourceAttr("data.betteruptime_on_call_calendar.this", "on_call_rotation.#", "0"), | ||
), | ||
}, | ||
}, | ||
|
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
Oops, something went wrong.