Skip to content

Commit 63122a4

Browse files
committed
Add module examples
1 parent efc44bc commit 63122a4

File tree

6 files changed

+137
-0
lines changed

6 files changed

+137
-0
lines changed

examples/basic/main.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
provider "statuscake" {}
2+
3+
# Create an HTTP uptime check, a pagespeed check, and an SSL check for each
4+
# website contained in the local `websites` variable.
5+
module "monitoring_suite" {
6+
source = "StatusCakeDev/monitoring-suite/statuscake"
7+
version = "0.1.0"
8+
9+
check_name = "Google"
10+
website_url = "https://www.google.com"
11+
12+
pagespeed_check_interval = 1800
13+
pagespeed_region = "UK"
14+
15+
ssl_check_interval = 86400
16+
ssl_on_mixed = false
17+
18+
uptime_check_interval = 60
19+
uptime_confirmation = 2
20+
uptime_trigger_rate = 30
21+
uptime_request_method = "HTTP"
22+
uptime_status_codes = ["301"]
23+
uptime_validate_ssl = true
24+
uptime_regions = ["london"]
25+
}

examples/basic/versions.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
statuscake = {
4+
source = "StatusCakeDev/statuscake"
5+
version = "~> 2.0.4"
6+
}
7+
}
8+
}

examples/contact-groups/main.tf

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
provider "statuscake" {}
2+
3+
resource "statuscake_contact_group" "operations_team" {
4+
name = "Operations Team"
5+
6+
email_addresses = [
7+
"johnsmith@example.com",
8+
"janesmith@example.com",
9+
]
10+
}
11+
12+
resource "statuscake_contact_group" "development_team" {
13+
name = "Development Team"
14+
15+
email_addresses = [
16+
"developers@example.com",
17+
]
18+
}
19+
20+
# Create an HTTP uptime check, a pagespeed check, and an SSL check for each
21+
# website contained in the local `websites` variable.
22+
module "monitoring_suite" {
23+
source = "StatusCakeDev/monitoring-suite/statuscake"
24+
version = "0.1.0"
25+
26+
check_name = "Google"
27+
website_url = "https://www.google.com"
28+
29+
pagespeed_check_interval = 1800
30+
pagespeed_region = "UK"
31+
32+
ssl_check_interval = 86400
33+
ssl_on_mixed = false
34+
35+
uptime_check_interval = 60
36+
uptime_confirmation = 2
37+
uptime_trigger_rate = 30
38+
uptime_request_method = "HTTP"
39+
uptime_status_codes = ["301"]
40+
uptime_validate_ssl = true
41+
uptime_regions = ["london"]
42+
43+
contact_groups = [
44+
statuscake_contact_group.operations_team.id,
45+
statuscake_contact_group.operations_team.id,
46+
]
47+
}

examples/contact-groups/versions.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
statuscake = {
4+
source = "StatusCakeDev/statuscake"
5+
version = "~> 2.0.4"
6+
}
7+
}
8+
}

examples/multiple/main.tf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
provider "statuscake" {}
2+
3+
locals {
4+
websites = {
5+
StatusCake = {
6+
website_url = "https://www.statuscake.com"
7+
uptime_regions = ["london", "paris", "frankfurt"]
8+
}
9+
Google = {
10+
website_url = "https://www.google.com"
11+
pagespeed_region = "US"
12+
ssl_on_mixed = false
13+
uptime_regions = ["california", "texas"]
14+
}
15+
}
16+
}
17+
18+
# Create an HTTP uptime check, a pagespeed check, and an SSL check for each
19+
# website contained in the local `websites` variable.
20+
module "monitoring_suite" {
21+
for_each = local.websites
22+
source = "StatusCakeDev/monitoring-suite/statuscake"
23+
version = "0.1.0"
24+
25+
check_name = each.key
26+
website_url = each.value.website_url
27+
28+
pagespeed_check_interval = lookup(each.value, "pagespeed_check_interval", 1800)
29+
pagespeed_region = lookup(each.value, "pagespeed_region", "UK")
30+
31+
ssl_check_interval = lookup(each.value, "ssl_check_interval", 86400)
32+
ssl_on_mixed = lookup(each.value, "ssl_on_mixed", false)
33+
34+
uptime_check_interval = lookup(each.value, "uptime_check_interval", 60)
35+
uptime_confirmation = lookup(each.value, "uptime_confirmation", 2)
36+
uptime_trigger_rate = lookup(each.value, "uptime_trigger_rate", 30)
37+
uptime_request_method = lookup(each.value, "uptime_request_method", "HTTP")
38+
uptime_status_codes = lookup(each.value, "uptime_status_codes", ["301"])
39+
uptime_validate_ssl = lookup(each.value, "uptime_ssl", true)
40+
uptime_regions = lookup(each.value, "uptime_regions", ["london"])
41+
}

examples/multiple/versions.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
statuscake = {
4+
source = "StatusCakeDev/statuscake"
5+
version = "~> 2.0.4"
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)