Google Compute Engine Region Health Check

This page shows how to write Terraform for Compute Engine Region Health Check and write them securely.

code-icon

Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.

get-started-button

Terraform Example (google_compute_region_health_check)

Health Checks determine whether instances are responsive and able to do work. They are an important part of a comprehensive load balancing configuration, as they enable monitoring instances behind load balancers. Health Checks poll instances at a specified interval. Instances that do not respond successfully to some number of probes in a row are marked as unhealthy. No new connections are sent to unhealthy instances, though existing connections will continue. The health check will continue to poll unhealthy instances. If an instance later responds successfully to some number of consecutive probes, it is marked healthy again and can receive new connections. To get more information about RegionHealthCheck, see:

Parameters

  • check_interval_sec optional - number
    • How often (in seconds) to send a health check. The default value is 5 seconds.

  • creation_timestamp requiredcomputed - string
    • Creation timestamp in RFC3339 text format.

  • description optional - string
    • An optional description of this resource. Provide this property when you create the resource.

  • healthy_threshold optional - number
    • A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2.

  • id optionalcomputed - string
  • name required - string
    • Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression 'a-z?' which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

  • project optionalcomputed - string
  • region optionalcomputed - string
    • The Region in which the created health check should reside. If it is not provided, the provider region is used.

  • self_link requiredcomputed - string
  • timeout_sec optional - number
    • How long (in seconds) to wait before claiming failure. The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec.

  • type requiredcomputed - string
    • The type of the health check. One of HTTP, HTTP2, HTTPS, TCP, or SSL.

  • unhealthy_threshold optional - number
    • A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2.

Example Usage (from GitHub)

github-iconbyronwhitlock-google/AutoML-Labeling-Tool
resource "google_compute_region_health_check" "automl_health_check" {
  provider = google-beta

  project = var.project_id
  region  = var.region
  name    = var.automl_health_check
github-icond1nesh12345/Iac-demo
resource "google_compute_region_health_check" "hc" {
  provider           = google
  name        = "http-health-check"
  description = "Health check via http"
  region             = "us-central1"
  timeout_sec         = 1
github-iconericprocopio/automl-labeling-tool
resource "google_compute_region_health_check" "automl_health_check" {
  provider = google-beta

  project = var.project_id
  region  = var.region
  name    = var.automl_health_check
github-iconLisandroLuna/terraspace
resource "google_compute_region_health_check" "default" {
  name     = var.rhc_name // "l7-ilb-hc"
  region   = var.rhc_region // "europe-west1"
  http_health_check {
    port_specification = var.rhc_port_speci // "USE_SERVING_PORT"
  }
github-iconPawel-Matuszny/terraweb
resource "google_compute_region_health_check" "hc" {
  provider           = google
  name               = "check-website-backend"
  check_interval_sec = 1
  timeout_sec        = 1
  region             = var.region

Frequently asked questions

What is Google Compute Engine Region Health Check?

Google Compute Engine Region Health Check is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine Region Health Check?

For Terraform, the byronwhitlock-google/AutoML-Labeling-Tool, d1nesh12345/Iac-demo and ericprocopio/automl-labeling-tool source code examples are useful. See the Terraform Example section for further details.