-
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.
- Loading branch information
1 parent
0653f61
commit 08608cc
Showing
4 changed files
with
261 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
terraform { | ||
required_providers { | ||
firehydrant = { | ||
source = "firehydrant/firehydrant" | ||
version = ">= 0.7.1" | ||
} | ||
} | ||
} | ||
|
||
data "firehydrant_user" "local" { | ||
email = "[email protected]" | ||
} | ||
|
||
data "firehydrant_user" "mika" { | ||
email = "[email protected]" | ||
} | ||
|
||
data "firehydrant_user" "kiran" { | ||
email = "[email protected]" | ||
} | ||
|
||
data "firehydrant_user" "horse" { | ||
email = "[email protected]" | ||
} | ||
|
||
data "firehydrant_user" "jack" { | ||
email = "[email protected]" | ||
} | ||
|
||
data "firehydrant_user" "wong" { | ||
email = "[email protected]" | ||
} | ||
|
||
resource "firehydrant_team" "aaaa_ipv6_migration_strategy" { | ||
name = "AAAA IPv6 migration strategy" | ||
|
||
memberships { | ||
user_id = data.firehydrant_user.local.id | ||
} | ||
|
||
memberships { | ||
user_id = data.firehydrant_user.kiran.id | ||
} | ||
|
||
memberships { | ||
user_id = data.firehydrant_user.wong.id | ||
} | ||
} | ||
|
||
import { | ||
id = "47016143-6547-483a-b68a-5220b21681fd" | ||
to = firehydrant_team.aaaa_ipv6_migration_strategy | ||
} | ||
|
||
resource "firehydrant_team" "dunder_mifflin_scranton" { | ||
name = "Dunder Mifflin Scranton" | ||
|
||
memberships { | ||
user_id = data.firehydrant_user.jack.id | ||
} | ||
} | ||
|
||
import { | ||
id = "97d539b0-47a5-44f6-81e6-b6fcd98f23ac" | ||
to = firehydrant_team.dunder_mifflin_scranton | ||
} | ||
|
||
resource "firehydrant_on_call_schedule" "aaaa_ipv6_migration_strategy_jen_primary_layer_2" { | ||
name = "Jen - primary - Layer 2" | ||
description = "(Layer 2)" | ||
team_id = resource.firehydrant_team.aaaa_ipv6_migration_strategy.id | ||
time_zone = "America/Los_Angeles" | ||
|
||
member_ids = [data.firehydrant_user.kiran.id] | ||
|
||
strategy { | ||
type = "weekly" | ||
handoff_time = "16:00" | ||
handoff_day = "monday" | ||
} | ||
|
||
restrictions { | ||
start_day = "monday" | ||
start_time = "09:00:00" | ||
end_day = "friday" | ||
end_time = "17:00:00" | ||
} | ||
} | ||
|
||
resource "firehydrant_on_call_schedule" "aaaa_ipv6_migration_strategy_jen_primary_layer_1" { | ||
name = "Jen - primary - Layer 1" | ||
description = "(Layer 1)" | ||
team_id = resource.firehydrant_team.aaaa_ipv6_migration_strategy.id | ||
time_zone = "America/Los_Angeles" | ||
|
||
member_ids = [data.firehydrant_user.wong.id, data.firehydrant_user.local.id] | ||
|
||
strategy { | ||
type = "weekly" | ||
handoff_time = "16:00" | ||
handoff_day = "friday" | ||
} | ||
|
||
restrictions { | ||
start_day = "sunday" | ||
start_time = "09:00:00" | ||
end_day = "sunday" | ||
end_time = "17:00:00" | ||
} | ||
|
||
restrictions { | ||
start_day = "monday" | ||
start_time = "09:00:00" | ||
end_day = "monday" | ||
end_time = "17:00:00" | ||
} | ||
|
||
restrictions { | ||
start_day = "tuesday" | ||
start_time = "09:00:00" | ||
end_day = "tuesday" | ||
end_time = "17:00:00" | ||
} | ||
|
||
restrictions { | ||
start_day = "wednesday" | ||
start_time = "09:00:00" | ||
end_day = "wednesday" | ||
end_time = "17:00:00" | ||
} | ||
|
||
restrictions { | ||
start_day = "thursday" | ||
start_time = "09:00:00" | ||
end_day = "thursday" | ||
end_time = "17:00:00" | ||
} | ||
|
||
restrictions { | ||
start_day = "friday" | ||
start_time = "09:00:00" | ||
end_day = "friday" | ||
end_time = "17:00:00" | ||
} | ||
|
||
restrictions { | ||
start_day = "saturday" | ||
start_time = "09:00:00" | ||
end_day = "saturday" | ||
end_time = "17:00:00" | ||
} | ||
} | ||
|
||
resource "firehydrant_on_call_schedule" "dunder_mifflin_scranton_jack_on_call_schedule_layer_1" { | ||
name = "Jack On-Call Schedule - Layer 1" | ||
description = " (Layer 1)" | ||
team_id = resource.firehydrant_team.dunder_mifflin_scranton.id | ||
time_zone = "America/Los_Angeles" | ||
|
||
member_ids = [data.firehydrant_user.jack.id] | ||
|
||
strategy { | ||
type = "weekly" | ||
handoff_time = "14:00" | ||
handoff_day = "friday" | ||
} | ||
} |
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,50 @@ | ||
INSERT INTO fh_users VALUES('0946be55-ea20-4483-b9ab-617d5f0969e2','Admin Account','[email protected]'); | ||
INSERT INTO fh_users VALUES('e6009411-0015-43e3-815e-ca9db72f4088','Mika','[email protected]'); | ||
INSERT INTO fh_users VALUES('4c3f28fa-b402-453c-9652-f014ecbe65a9', 'Kiran','[email protected]'); | ||
INSERT INTO fh_users VALUES('35b5390f-d134-4bc6-966d-0b4048788b62','Horse','[email protected]'); | ||
INSERT INTO fh_users VALUES('6c08bff2-98f6-4ee9-8de1-12202186d084','Jack T.','[email protected]'); | ||
INSERT INTO fh_users VALUES('032a1f07-987e-4f76-8273-136e08e50baa', 'Wong','[email protected]'); | ||
|
||
INSERT INTO ext_users VALUES('PXI6XNI','Admin','[email protected]','0946be55-ea20-4483-b9ab-617d5f0969e2'); | ||
INSERT INTO ext_users VALUES('P5A1XH2','Mika','[email protected]','e6009411-0015-43e3-815e-ca9db72f4088'); | ||
INSERT INTO ext_users VALUES('P8ZZ1ZB','Kiran','[email protected]','4c3f28fa-b402-453c-9652-f014ecbe65a9'); | ||
INSERT INTO ext_users VALUES('PRXEEQ8','Horse','[email protected]','35b5390f-d134-4bc6-966d-0b4048788b62'); | ||
INSERT INTO ext_users VALUES('P4CMCAU','Jack T.','[email protected]','6c08bff2-98f6-4ee9-8de1-12202186d084'); | ||
INSERT INTO ext_users VALUES('P2C9LBA','Wong','[email protected]','032a1f07-987e-4f76-8273-136e08e50baa'); | ||
|
||
INSERT INTO fh_teams VALUES('47016143-6547-483a-b68a-5220b21681fd','AAAA IPv6 migration strategy','aaaa-ipv6-migration-strategy'); | ||
INSERT INTO fh_teams VALUES('f159b173-1ffd-41ac-9254-ce8ec1142267','🐴 Cowboy Coders','cowboy-coders'); | ||
INSERT INTO fh_teams VALUES('97d539b0-47a5-44f6-81e6-b6fcd98f23ac','Dunder Mifflin Scranton','dunder-mifflin-scranton'); | ||
|
||
INSERT INTO ext_teams VALUES('PT54U20','Jen','jen','47016143-6547-483a-b68a-5220b21681fd'); | ||
INSERT INTO ext_teams VALUES('PD2F80U','Jack Team','jack-team','97d539b0-47a5-44f6-81e6-b6fcd98f23ac'); | ||
|
||
INSERT INTO ext_memberships VALUES('PXI6XNI','PT54U20'); | ||
INSERT INTO ext_memberships VALUES('P8ZZ1ZB','PT54U20'); | ||
INSERT INTO ext_memberships VALUES('P2C9LBA','PT54U20'); | ||
INSERT INTO ext_memberships VALUES('P4CMCAU','PD2F80U'); | ||
|
||
INSERT INTO ext_schedules VALUES('P3D7DLW-PC1DX4O','Jen - primary - Layer 2','(Layer 2)','America/Los_Angeles','weekly','','16:00','monday'); | ||
INSERT INTO ext_schedules VALUES('P3D7DLW-PSQ0VRL','Jen - primary - Layer 1','(Layer 1)','America/Los_Angeles','weekly','','16:00','friday'); | ||
INSERT INTO ext_schedules VALUES('PVJMUIC-P3BRVNT','CS-on-call - Layer 1',' (Layer 1)','America/Los_Angeles','daily','','10:00','tuesday'); | ||
INSERT INTO ext_schedules VALUES('P85QTXZ-PE2BA4Y','Jack On-Call Schedule - Layer 1',' (Layer 1)','America/Los_Angeles','weekly','','14:00','friday'); | ||
INSERT INTO ext_schedules VALUES('PGR96WL-PR3J6XJ','🐴 is always on call - Layer 1','(Layer 1)','America/Los_Angeles','weekly','','12:00','friday'); | ||
|
||
INSERT INTO ext_schedule_restrictions VALUES('P3D7DLW-PC1DX4O','0','09:00:00','monday','17:00:00','friday'); | ||
INSERT INTO ext_schedule_restrictions VALUES('P3D7DLW-PSQ0VRL','0-0','09:00:00','sunday','17:00:00','sunday'); | ||
INSERT INTO ext_schedule_restrictions VALUES('P3D7DLW-PSQ0VRL','0-1','09:00:00','monday','17:00:00','monday'); | ||
INSERT INTO ext_schedule_restrictions VALUES('P3D7DLW-PSQ0VRL','0-2','09:00:00','tuesday','17:00:00','tuesday'); | ||
INSERT INTO ext_schedule_restrictions VALUES('P3D7DLW-PSQ0VRL','0-3','09:00:00','wednesday','17:00:00','wednesday'); | ||
INSERT INTO ext_schedule_restrictions VALUES('P3D7DLW-PSQ0VRL','0-4','09:00:00','thursday','17:00:00','thursday'); | ||
INSERT INTO ext_schedule_restrictions VALUES('P3D7DLW-PSQ0VRL','0-5','09:00:00','friday','17:00:00','friday'); | ||
INSERT INTO ext_schedule_restrictions VALUES('P3D7DLW-PSQ0VRL','0-6','09:00:00','saturday','17:00:00','saturday'); | ||
|
||
INSERT INTO ext_schedule_teams VALUES('P3D7DLW-PC1DX4O','PT54U20'); | ||
INSERT INTO ext_schedule_teams VALUES('P3D7DLW-PSQ0VRL','PT54U20'); | ||
INSERT INTO ext_schedule_teams VALUES('P85QTXZ-PE2BA4Y','PD2F80U'); | ||
|
||
INSERT INTO ext_schedule_members VALUES('P3D7DLW-PC1DX4O','P8ZZ1ZB'); | ||
INSERT INTO ext_schedule_members VALUES('P3D7DLW-PSQ0VRL','PXI6XNI'); | ||
INSERT INTO ext_schedule_members VALUES('P3D7DLW-PSQ0VRL','P2C9LBA'); | ||
INSERT INTO ext_schedule_members VALUES('P85QTXZ-PE2BA4Y','P4CMCAU'); | ||
INSERT INTO ext_schedule_members VALUES('PGR96WL-PR3J6XJ','PRXEEQ8'); |
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,35 @@ | ||
package tfrender_test | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/firehydrant/signals-migrator/store" | ||
"gotest.tools/golden" | ||
) | ||
|
||
func TestRenderPagerDutySample(t *testing.T) { | ||
ctx, tfr := tfrInit(t) | ||
|
||
seed, err := os.ReadFile("testdata/pagerduty_seed.sql") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
sql := strings.TrimSpace(string(seed)) | ||
|
||
if _, err := store.FromContext(ctx).ExecContext(ctx, sql); err != nil { | ||
t.Fatal(err) | ||
} | ||
if err := tfr.Write(ctx); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
content, err := os.ReadFile(tfr.Filepath()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
golden.Assert(t, string(content), goldenFile(tfr.Filename())) | ||
} |