Skip to main content

Terraform

StatusCake provides a comprehensive Terraform provider to manage monitoring resources declaratively. Rather than creating checks one at a time, you describe the monitoring you want in configuration files, and Terraform works out what has to change to make StatusCake match.

main.tf
resource "statuscake_uptime_check" "example" {
name = "Example"
check_interval = 300

http_check {}

monitored_resource {
address = "https://www.example.com"
}
}
caution

It is assumed you are already familiar with Terraform and have it installed. If not check out the installation page to get started.

info

The examples in these guides work with Terraform 1.x and above.

Why use Terraform for monitoring​

  • Monitoring is reviewed like code. A new check, or a change to who is alerted, is a pull request that a colleague can read before it takes effect.
  • Nothing is forgotten. Create a service and its monitoring in the same change, so that no service goes live unwatched.
  • Drift is visible. Terraform compares what you wrote with what exists, and terraform plan shows any difference before anything is changed.
  • Repeatable. The same configuration can create identical monitoring for staging and production, or for every tenant you onboard.
  • Cleaned up with the service. When the service is removed, so are its checks, instead of lingering and alerting about something that no longer exists.

If you prefer to make changes directly and immediately, the CLI is a better fit. If monitoring is created by your own software at runtime, use an SDK.

What the provider manages​

KindNameManages
Resourcestatuscake_uptime_checkUptime checks of every type.
Resourcestatuscake_pagespeed_checkPagespeed checks.
Resourcestatuscake_ssl_checkSSL certificate checks.
Resourcestatuscake_heartbeat_checkHeartbeat checks.
Resourcestatuscake_contact_groupWho is alerted.
Resourcestatuscake_maintenance_windowWhen alerts are silenced.
Data sourcestatuscake_contact_groupAn existing contact group.
Data sourcestatuscake_uptime_monitoring_locationsWhere uptime checks can run from.
Data sourcestatuscake_pagespeed_monitoring_locationsWhere pagespeed checks can run from.

The complete argument reference for each is on the Terraform Registry. These guides explain how to use them together.

How these guides are organised​

GuideWhat it covers
InstallationDeclaring and downloading the provider.
AuthenticationGiving the provider an API token safely.
ConfigurationRetries, backoff and throttling.
Quick StartCreating, changing and destroying your first check.
Uptime ChecksEvery type of uptime check.
Other ChecksPagespeed, SSL and heartbeat checks.
AlertingContact groups and maintenance windows.
Data SourcesLooking up existing contact groups and locations.
ImportingBringing existing checks under Terraform.
TroubleshootingFixing common problems.

Next Steps​

Install the provider.