Skip to content

Commit

Permalink
Terraform uptimerobot monitors
Browse files Browse the repository at this point in the history
Add our uptimerobot to terraform so it's managed in code and we can
easily extend it. This currently only adds our to be monitored sites and
leaves the status page as is now.

Deleting resources on uptimerobot will cause terraform unable to run
see: louy/terraform-provider-uptimerobot#82
  • Loading branch information
jelly committed May 14, 2021
1 parent 03c031d commit 5690206
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
11 changes: 11 additions & 0 deletions group_vars/all/vault_uptimerobot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$ANSIBLE_VAULT;1.1;AES256
62633262613331616434383361643166396632326534376238363661343162383563633738666165
3265376465363330373030636337643838663232346331660a356536353363363837323466363066
65363737363465643633323536393261636438383336343334656439333136383934376538653466
3965373639366131330a633962366637396332363237363364383238663133323664616132303365
62653761353366623364363365633937343339386562323133353030316635376265356166343965
64333931383836306563373138383262313335663530623863666565656136653162333437333536
34346632313438386362643433373936346266353562333562303562303432316330663261303636
32363735346366323038346336386364313634356131633463373837366261623534626361636563
36656164633363396231346135643765663062656230333838343538643361383632373533306236
3261343064333737346166316562616637353330373736633634
19 changes: 19 additions & 0 deletions tf-stage2/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions tf-stage2/uptimerobot.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
data "external" "vault_uptimerobot" {
program = ["${path.module}/../misc/get_key.py", "group_vars/all/vault_uptimerobot.yml",
"vault_uptimerobot_api_key",
"vault_uptimerobot_alert_contact",
"--format", "json"]
}

provider "uptimerobot" {
api_key = data.external.vault_uptimerobot.result.vault_uptimerobot_api_key
}

data "uptimerobot_account" "account" {}

data "uptimerobot_alert_contact" "default_alert_contact" {
friendly_name = data.external.vault_uptimerobot.result.vault_uptimerobot_alert_contact
}

locals {
# This creates to be monitored websites.
# Every line consists of "key" = "value":
# - key equals the friendly name
# - value equals the website url
archlinux_org_monitor = {
"Wiki" = "https://wiki.archlinux.org"
"Website" = "https://archlinux.org"
"Security Tracker" = "https://security.archlinux.org"
"Gitlab" = "https://gitlab.archlinux.org"
"Forum" = "https://bbs.archlinux.org"
"Bugtracker" = "https://bugs.archlinux.org"
"AUR" = "https://aur.archlinux.org"
}
}

resource "uptimerobot_monitor" "uptimerobot_monitor_archlinux" {
for_each = local.archlinux_org_monitor

friendly_name = each.key
type = "http"
url = each.value
interval = 60

alert_contact {
id = data.uptimerobot_alert_contact.default_alert_contact.id
}
}
4 changes: 4 additions & 0 deletions tf-stage2/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ terraform {
source = "mrparkers/keycloak"
version = "2.0.0"
}
uptimerobot = {
source = "louy/uptimerobot"
version = "0.5.1"
}
}
required_version = ">= 0.13"
}

0 comments on commit 5690206

Please sign in to comment.