Google Cloud (Stackdriver) Monitoring Uptime Check Config

This page shows how to write Terraform for Cloud (Stackdriver) Monitoring Uptime Check Config and write them securely.

google_monitoring_uptime_check_config (Terraform)

The Uptime Check Config in Cloud (Stackdriver) Monitoring can be configured in Terraform with the resource name google_monitoring_uptime_check_config. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub
resource "google_monitoring_uptime_check_config" "tfer--projects-002F-wbstack-002F-uptimeCheckConfigs-002F-addshore-002D-alpha-002D-query-002D-service-002D-ui" {
  content_matchers {
    content = "query-helper-help"
    matcher = "CONTAINS_STRING"
resource "google_monitoring_uptime_check_config" "http" {
  display_name = "01 - Website uptime check [global]"
  timeout = "10s"
  period = "60s"

  http_check {
resource "google_monitoring_uptime_check_config" "my_check" {
  display_name =
  timeout      = var.timeout
  period       = var.period
  http_check {
    path    = var.healthcheck_path
resource "google_monitoring_uptime_check_config" "http" {
  display_name = "1 - Website uptime check [global]"
  timeout = "10s"
  period = "60s"
  http_check {
    path = "/"

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


A human-friendly name for the uptime check configuration. The display name should be unique within a Stackdriver Workspace in order to make it easier to identify; however, uniqueness is not enforced.

  • id optional computed - string
  • name optional computed - string

A unique resource name for this UptimeCheckConfig. The format is projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].

How often, in seconds, the uptime check is performed. Currently, the only supported values are 60s (1 minute), 300s (5 minutes), 600s (10 minutes), and 900s (15 minutes). Optional, defaults to 300s.

The list of regions from which the check will be run. Some regions contain one location, and others contain more than one. If this field is specified, enough regions to include a minimum of 3 locations must be provided, or an error message is returned. Not specifying this field will result in uptime checks running from all regions.

The maximum amount of time to wait for the request to complete (must be between 1 and 60 seconds). Accepted formats

The id of the uptime check

  • content_matchers list block

    String or regex content to match (max 1024 bytes)

    The type of content matcher that will be applied to the server output, compared to the content string when the check is run. Default value: "CONTAINS_STRING" Possible values: ["CONTAINS_STRING", "NOT_CONTAINS_STRING", "MATCHES_REGEX", "NON_MATCHES_REGEX"]

  • http_check list block

    The request body associated with the HTTP POST request. If contentType is URL_ENCODED, the body passed in must be URL-encoded. Users can provide a Content-Length header via the headers field or the API will do so. If the requestMethod is GET and body is not empty, the API will return an error. The maximum byte size is 1 megabyte. Note - As with all bytes fields JSON representations are base64 encoded. e.g. "foo=bar" in URL-encoded form is "foo%3Dbar" and in base64 encoding is "Zm9vJTI1M0RiYXI=".

    The content type to use for the check. Possible values: ["TYPE_UNSPECIFIED", "URL_ENCODED"]

    • headers optional computed - map from string to string

    The list of headers to send as part of the uptime check request. If two headers have the same key and different values, they should be entered as a single header, with the value being a comma-separated list of all the desired values as described at (page 31). Entering two separate headers with the same key in a Create call will cause the first to be overwritten by the second. The maximum number of headers allowed is 100.

    Boolean specifying whether to encrypt the header information. Encryption should be specified for any headers related to authentication that you do not wish to be seen when retrieving the configuration. The server will be responsible for encrypting the headers. On Get/List calls, if mask_headers is set to True then the headers will be obscured with **.

    The path to the page to run the check against. Will be combined with the host (specified within the MonitoredResource) and port to construct the full URL. Optional (defaults to "/").

    • port optional computed - number

    The port to the page to run the check against. Will be combined with host (specified within the MonitoredResource) and path to construct the full URL. Optional (defaults to 80 without SSL, or 443 with SSL).

    The HTTP request method to use for the check. If set to METHOD_UNSPECIFIED then requestMethod defaults to GET. Default value: "GET" Possible values: ["METHOD_UNSPECIFIED", "GET", "POST"]

    If true, use HTTPS instead of HTTP to run the check.

    Boolean specifying whether to include SSL certificate validation as a part of the Uptime check. Only applies to checks where monitoredResource is set to uptime_url. If useSsl is false, setting validateSsl to true has no effect.

  • monitored_resource list block
    • labels required - map from string to string

    Values for all of the labels listed in the associated monitored resource descriptor. For example, Compute Engine VM instances use the labels "project_id", "instance_id", and "zone".

    The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor ( object. For example, the type of a Compute Engine VM instance is gce_instance. For a list of types, see Monitoring resource types ( and Logging resource types (

  • resource_group list block

    The group of resources being monitored. Should be the 'name' of a group

    The resource type of the group members. Possible values: ["RESOURCE_TYPE_UNSPECIFIED", "INSTANCE", "AWS_ELB_LOAD_BALANCER"]

  • tcp_check list block

    The port to the page to run the check against. Will be combined with host (specified within the MonitoredResource) to construct the full URL.

  • timeouts single block

Explanation in Terraform Registry

This message configures which resources and services to monitor for availability. To get more information about UptimeCheckConfig, see:

Frequently asked questions

What is Google Cloud (Stackdriver) Monitoring Uptime Check Config?

Google Cloud (Stackdriver) Monitoring Uptime Check Config is a resource for Cloud (Stackdriver) Monitoring of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Cloud (Stackdriver) Monitoring Uptime Check Config?

For Terraform, the wbstack/deploy, charlesbaer/stackdriver-automation and DNXLabs/terraform-google-stackdriver-uptime source code examples are useful. See the Terraform Example section for further details.


Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.