Checks
Browser checks, API checks, Heartbeat monitors and Multistep checks share many arguments, configuration-wise, but also have their own unique ones. The type of your check is controlled using thetype argument.
Browser checks
For example, a browser check can look as follows:You can see all the configuration options for checks on the official Terraform registry documentation page.
API checks
On the other hand, an API check shares some part of the initial configuration, but is organized around therequest argument instead of the script argument:
You can see all the configuration options for checks on the official Terraform registry documentation page.
Heartbeat monitors
For example, a heartbeat monitor can look as follows:tfstate file.
Multistep checks
As with Browser checks, when constructing a Multistep check it is possible to provide the script directly in-line, but the recommended approach is to store scripts in separate files.Multistep checks are only supported on runtime 2023.09 or later. See Runtimes for more details.For example, a Multistep check can look as follows:
Tcp Monitors
TCP monitors verify the availability and responsiveness of services running on specific ports, ensuring they are reachable and operating within acceptable response time thresholds. Below is a sample configuration for a TCP monitor using Terraform:Groups
Once you start having more than just a handful of checks, it makes sense to start looking into groups to keep things tidy:Adding checks to groups
To add a check to a group, link it to that group by setting thegroup_id argument to the group’s resource ID. For example, to link the API check and the group from this article:
Locations and alert channel subscriptions defined at group level always trump the ones defined at check level. Double-check your config to make sure all checks are running from the intended regions and are set to alert on the correct channels.You can see all the configuration options for groups, as well as more examples, on the official Terraform registry documentation page.