/
main.tf
128 lines (108 loc) · 2.74 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
terraform {
required_providers {
checkly = {
source = "checkly/checkly"
version = "~> 1.0"
}
}
}
variable "checkly_api_key" {}
variable "checkly_account_id" {}
provider "checkly" {
api_key = var.checkly_api_key
account_id = var.checkly_account_id
}
resource "checkly_check" "api-check-1" {
name = "Example API check"
type = "API"
activated = true
frequency = 1
double_check = true
locations = [
"us-west-1",
"eu-central-1"
]
group_id = checkly_check_group.group-1.id
request {
url = "https://danube-web.shop/api/books"
follow_redirects = true
skip_ssl = false
assertion {
source = "JSON_BODY"
property = "$..title"
comparison = "NOT_EMPTY"
}
}
}
resource "checkly_check" "browser-check-1" {
name = "Example browser check"
type = "BROWSER"
activated = true
frequency = 10
double_check = true
locations = [
"us-west-1",
"eu-central-1"
]
group_id = checkly_check_group.group-1.id
script = <<EOT
const assert = require("chai").assert;
const { chromium } = require("playwright");
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto("https://danube-web.shop");
const title = await page.title();
assert.equal(title, "Google");
await browser.close();
EOT
}
resource "checkly_check_group" "group-1" {
name = "Example group"
activated = true
muted = false
tags = [
"auto"
]
locations = [
"eu-west-1",
]
concurrency = 3
double_check = true
alert_channel_subscription {
channel_id = checkly_alert_channel.email_ac.id
activated = true
}
}
resource "checkly_alert_channel" "email_ac" {
email {
address = "john@example.com"
}
send_recovery = true
send_failure = true
send_degraded = false
}
# resource "checkly_dashboard" "example-dashboard" {
# custom_url = "checkly"
# custom_domain = "status.example.com"
# logo = "https://www.checklyhq.com/logo.png"
# header = "Public dashboard"
# refresh_rate = 60
# paginate = false
# pagination_rate = 30
# hide_tags = false
# }
resource "checkly_maintenance_windows" "maintenance-1" {
name = "Maintenance Windows"
starts_at = "2022-04-24T00:00:00.000Z"
ends_at = "2022-04-25T00:00:00.000Z"
repeat_unit = "MONTH"
repeat_ends_at = "2023-08-24T00:00:00.000Z"
repeat_interval = 1
tags = [
"auto",
]
}
resource "checkly_snippet" "example-1" {
name = "Example snippet"
script = "console.log('test');"
}