Skip to content

Commit f4ec873

Browse files
authored
Merge pull request #4 from checkly/alert_settings_computed
Alert settings computed
2 parents a2c3b6b + 5c15a51 commit f4ec873

File tree

4 files changed

+82
-4
lines changed

4 files changed

+82
-4
lines changed

.terraform-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.12.24

resource_check.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ func resourceCheck() *schema.Resource {
148148
"alert_settings": &schema.Schema{
149149
Type: schema.TypeSet,
150150
Optional: true,
151+
Computed: true,
151152
MaxItems: 1,
152153
Elem: &schema.Resource{
153154
Schema: map[string]*schema.Schema{
@@ -338,8 +339,7 @@ func resourceCheckRead(d *schema.ResourceData, client interface{}) error {
338339
if err != nil {
339340
return fmt.Errorf("API error: %v", err)
340341
}
341-
resourceDataFromCheck(&check, d)
342-
return nil
342+
return resourceDataFromCheck(&check, d)
343343
}
344344

345345
func resourceCheckUpdate(d *schema.ResourceData, client interface{}) error {

test.tf

+75-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,80 @@
1-
variable "checkly_api_key" {}
1+
variable "checkly_api_key" {
2+
}
23

34
provider "checkly" {
4-
api_key = "${var.checkly_api_key}"
5+
api_key = var.checkly_api_key
6+
}
7+
8+
resource "checkly_check" "test-check1" {
9+
name = "My test check 1"
10+
type = "API"
11+
activated = true
12+
should_fail = true
13+
frequency = 1
14+
ssl_check_domain = "example.com"
15+
double_check = true
16+
degraded_response_time = 15000
17+
max_response_time = 30000
18+
use_global_alert_settings = false
19+
20+
alert_settings {
21+
escalation_type = "RUN_BASED"
22+
23+
run_based_escalation {
24+
failed_run_threshold = 1
25+
}
26+
27+
time_based_escalation {
28+
minutes_failing_threshold = 5
29+
}
30+
31+
ssl_certificates {
32+
enabled = true
33+
alert_threshold = 30
34+
}
35+
36+
reminders {
37+
amount = 1
38+
}
39+
}
40+
41+
locations = [
42+
"us-west-1",
43+
"ap-northeast-1",
44+
"ap-south-1",
45+
]
46+
47+
request {
48+
follow_redirects = true
49+
url = "http://example.com/"
50+
51+
query_parameters = {
52+
search = "foo"
53+
}
54+
55+
headers = {
56+
X-Bogus = "bogus"
57+
}
58+
59+
assertion {
60+
source = "JSON_BODY"
61+
property = "code"
62+
comparison = "HAS_VALUE"
63+
target = "authentication.failed"
64+
}
65+
66+
assertion {
67+
source = "STATUS_CODE"
68+
property = ""
69+
comparison = "EQUALS"
70+
target = "401"
71+
}
72+
73+
basic_auth {
74+
username = ""
75+
password = ""
76+
}
77+
}
578
}
679

780
resource "checkly_check" "test-check2" {

versions.tf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
terraform {
3+
required_version = ">= 0.12"
4+
}

0 commit comments

Comments
 (0)