Get the installation code
Copy the installation code and save it in your Terraform file.
Defining your checks as code with Checkly’s Terraform provider makes monitoring large websites and APIs a breeze.
resource "checkly_check" "stripe-charges" {
name = "Stripe Charges"
type = "API"
activated = true
frequency = 1
ssl_check = true
use_global_alert_settings = true
locations = ["eu-central-1"]
request {
url = "https://api.stripe.com/v1charges"
follow_redirects = true
assertion {
source = "STATUS_CODE"
comparison = "EQUALS"
target = "200"
}
}
Already using Terraform for IaC? Great. Not using Terraform yet? Easily plug it into your existing pipeline.
Declaring your checks as code aligns your monitoring with your releases and rollbacks, while also serving as documentation.
Seamlessly develop and test your checks locally, push to source control and apply automatically.
Managing your checks, groups, alert channels and other monitoring resources should never be the bottleneck for shipping more code or increasing visibility into the state of your systems.
resource "checkly_check" "add-to-cart" {
name = "Add to cart"
type = "BROWSER"
frequency = 5
activated = true
locations = ["us-west-1", "eu-central-1"]
script = file("${path.module}/scripts/add-to-cart.js")
}
resource "checkly_check_group" "purchase" {
name = "Purchase"
activated = true
concurrency = 5
locations = [ "us-west-1", "eu-central-1"]
}
resource "checkly_check" "add-to-cart" {
name = "Add to cart"
type = "BROWSER"
frequency = 5
activated = true
locations = [ "us-west-1", "eu-central-1" ]
script = file("${path.module}/scripts/add-to-cart.js")
group_id = checkly_check_group.purchase.id
}
resource "checkly_check" "payment" {
name = "Payment"
type = "API"
frequency = 1
activated = true
locations = [ "us-west-1", "eu-central-1" ]
request {
url = "https://webshop.com/api/charges"
assertion {
source = "STATUS_CODE"
comparison = "EQUALS"
target = "200"
}
}
group_id = checkly_check_group.purchase.id
}
resource "checkly_alert_channel" "pagerduty_ac" {
pagerduty {
account = "checkly"
service_key = "key1"
service_name = "pdalert"
}
}
resource "checkly_alert_channel" "email_ac" {
email {
address = "john@acme.com"
}
}
resource "checkly_check_group" "purchase" {
name = "Purchase"
activated = true
concurrency = 5
locations = ["us-west-1", "eu-central-1"]
}
resource "checkly_check" "add-to-cart" {
name = "Add to cart"
type = "BROWSER"
frequency = 5
activated = true
locations = ["us-west-1", "eu-central-1"]
script = file("${path.module}/scripts/add-to-cart.js")
group_id = checkly_check_group.purchase.id
alert_channel_subscription {
channel_id = checkly_alert_channel.pagerduty_ac.id
activated = true
}
alert_channel_subscription {
channel_id = checkly_alert_channel.slack_ac.id
activated = true
}
}
resource "checkly_check" "payment" {
name = "Payment"
type = "API"
frequency = 1
activated = true
locations = ["us-west-1", "eu-central-1"]
request {
url = "https://webshop.com/api/charges"
assertion {
source = "STATUS_CODE"
comparison = "EQUALS"
target = "200"
}
}
group_id = checkly_check_group.purchase.id
alert_channel_subscription {
channel_id = checkly_alert_channel.email_ac.id
activated = true
}
}
Need hundreds or thousands of checks running at all times, giving teams the flexibility to manage their own resources independently? We take the power of IaC and apply it to monitoring.
"Checkly integrated with Terraform enables us to quickly create, modify, and deploy API and browser checks for a broad and diverse audience of internal customers."
Team Lead at Schwarz Group IT
Copy the installation code and save it in your Terraform file.
variable "checkly_api_key" {} variable "checkly_account_id" {} terraform { required_providers { checkly = { source = "checkly/checkly" version = "~> 1.0" } } } provider "checkly" { api_key = var.checkly_api_key account_id = var.checkly_account_id }
Find your API key and account ID in your user settings, then export them as environment variables.
$ export TF_VAR_checkly_api_key={YOUR_API_KEY}
$ export TF_VAR_checkly_account_id={YOUR_ACCOUNT_ID}
Initialize and apply your Terraform config.
$ terraform init
$ terraform apply
Start monitoring your API endpoints and your vital site transactions.
Start for free