# ComputeHealthCheck

| **Property** | **Value** |
|---|---|
| Google Cloud Service Name | Compute Engine |
| Google Cloud Service Documentation | [/compute/docs/](https://docs.cloud.google.com/compute/docs) |
| Google Cloud REST Resource Name | ``` v1.healthChecks ``` ``` v1.regionHealthChecks ``` |
| Google Cloud REST Resource Documentation | ``` /compute/docs/reference/rest/v1/healthChecks ``` ``` /compute/docs/reference/rest/v1/regionHealthChecks ``` |
| Config Connector Resource Short Names | computehealthcheck gcpcomputehealthcheck gcpcomputehealthchecks |
| Config Connector Service Name | compute.googleapis.com |
| Config Connector Resource Fully Qualified Name | computehealthchecks.compute.cnrm.cloud.google.com |
| Can Be Referenced by IAMPolicy/IAMPolicyMember | No |
| Config Connector Default Average Reconcile Interval In Seconds | 600 |

ComputeHealthCheck can manage both global and regional health checks. To manage a global ComputeHealthCheck use a value of `global` in
the `spec.location` field. To manage a regional ComputeHealthCheck, use a region name in the `spec.location` field.

## Custom Resource Definition Properties

### Annotations

| Fields ||
|---|---|
| `cnrm.cloud.google.com/project-id` |

### Spec

#### Schema

    checkIntervalSec: integer
    description: string
    grpcHealthCheck:
      grpcServiceName: string
      port: integer
      portName: string
      portSpecification: string
    healthyThreshold: integer
    http2HealthCheck:
      host: string
      port: integer
      portName: string
      portSpecification: string
      proxyHeader: string
      requestPath: string
      response: string
    httpHealthCheck:
      host: string
      port: integer
      portName: string
      portSpecification: string
      proxyHeader: string
      requestPath: string
      response: string
    httpsHealthCheck:
      host: string
      port: integer
      portName: string
      portSpecification: string
      proxyHeader: string
      requestPath: string
      response: string
    location: string
    logConfig:
      enable: boolean
    resourceID: string
    sourceRegions:
    - string
    sslHealthCheck:
      port: integer
      portName: string
      portSpecification: string
      proxyHeader: string
      request: string
      response: string
    tcpHealthCheck:
      port: integer
      portName: string
      portSpecification: string
      proxyHeader: string
      request: string
      response: string
    timeoutSec: integer
    unhealthyThreshold: integer

| Fields ||
|---|---|
| `checkIntervalSec` *Optional* | `integer` How often (in seconds) to send a health check. The default value is 5 seconds. |
| `description` *Optional* | `string` An optional description of this resource. Provide this property when you create the resource. |
| `grpcHealthCheck` *Optional* | `object` <br /> |
| `grpcHealthCheck.grpcServiceName` *Optional* | `string` The gRPC service name for the health check. The value of grpcServiceName has the following meanings by convention: - Empty serviceName means the overall status of all services at the backend. - Non-empty serviceName means the health of that gRPC service, as defined by the owner of the service. The grpcServiceName can only be ASCII. |
| `grpcHealthCheck.port` *Optional* | `integer` The port number for the health check request. Must be specified if portName and portSpecification are not set or if port_specification is USE_FIXED_PORT. Valid values are 1 through 65535. |
| `grpcHealthCheck.portName` *Optional* | `string` Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. |
| `grpcHealthCheck.portSpecification` *Optional* | `string` Specifies how port is selected for health checking, can be one of the following values: \* 'USE_FIXED_PORT': The port number in 'port' is used for health checking. \* 'USE_NAMED_PORT': The 'portName' is used for health checking. \* 'USE_SERVING_PORT': For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. If not specified, gRPC health check follows behavior specified in 'port' and 'portName' fields. Possible values: \["USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"\]. |
| `healthyThreshold` *Optional* | `integer` A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. |
| `http2HealthCheck` *Optional* | `object` <br /> |
| `http2HealthCheck.host` *Optional* | `string` The value of the host header in the HTTP2 health check request. If left empty (default value), the public IP on behalf of which this health check is performed will be used. |
| `http2HealthCheck.port` *Optional* | `integer` The TCP port number for the HTTP2 health check request. The default value is 443. |
| `http2HealthCheck.portName` *Optional* | `string` Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. |
| `http2HealthCheck.portSpecification` *Optional* | `string` Specifies how port is selected for health checking, can be one of the following values: \* 'USE_FIXED_PORT': The port number in 'port' is used for health checking. \* 'USE_NAMED_PORT': The 'portName' is used for health checking. \* 'USE_SERVING_PORT': For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. If not specified, HTTP2 health check follows behavior specified in 'port' and 'portName' fields. Possible values: \["USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"\]. |
| `http2HealthCheck.proxyHeader` *Optional* | `string` Specifies the type of proxy header to append before sending data to the backend. Default value: "NONE" Possible values: \["NONE", "PROXY_V1"\]. |
| `http2HealthCheck.requestPath` *Optional* | `string` The request path of the HTTP2 health check request. The default value is /. |
| `http2HealthCheck.response` *Optional* | `string` The bytes to match against the beginning of the response data. If left empty (the default value), any response will indicate health. The response data can only be ASCII. |
| `httpHealthCheck` *Optional* | `object` <br /> |
| `httpHealthCheck.host` *Optional* | `string` The value of the host header in the HTTP health check request. If left empty (default value), the public IP on behalf of which this health check is performed will be used. |
| `httpHealthCheck.port` *Optional* | `integer` The TCP port number for the HTTP health check request. The default value is 80. |
| `httpHealthCheck.portName` *Optional* | `string` Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. |
| `httpHealthCheck.portSpecification` *Optional* | `string` Specifies how port is selected for health checking, can be one of the following values: \* 'USE_FIXED_PORT': The port number in 'port' is used for health checking. \* 'USE_NAMED_PORT': The 'portName' is used for health checking. \* 'USE_SERVING_PORT': For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. If not specified, HTTP health check follows behavior specified in 'port' and 'portName' fields. Possible values: \["USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"\]. |
| `httpHealthCheck.proxyHeader` *Optional* | `string` Specifies the type of proxy header to append before sending data to the backend. Default value: "NONE" Possible values: \["NONE", "PROXY_V1"\]. |
| `httpHealthCheck.requestPath` *Optional* | `string` The request path of the HTTP health check request. The default value is /. |
| `httpHealthCheck.response` *Optional* | `string` The bytes to match against the beginning of the response data. If left empty (the default value), any response will indicate health. The response data can only be ASCII. |
| `httpsHealthCheck` *Optional* | `object` <br /> |
| `httpsHealthCheck.host` *Optional* | `string` The value of the host header in the HTTPS health check request. If left empty (default value), the public IP on behalf of which this health check is performed will be used. |
| `httpsHealthCheck.port` *Optional* | `integer` The TCP port number for the HTTPS health check request. The default value is 443. |
| `httpsHealthCheck.portName` *Optional* | `string` Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. |
| `httpsHealthCheck.portSpecification` *Optional* | `string` Specifies how port is selected for health checking, can be one of the following values: \* 'USE_FIXED_PORT': The port number in 'port' is used for health checking. \* 'USE_NAMED_PORT': The 'portName' is used for health checking. \* 'USE_SERVING_PORT': For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. If not specified, HTTPS health check follows behavior specified in 'port' and 'portName' fields. Possible values: \["USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"\]. |
| `httpsHealthCheck.proxyHeader` *Optional* | `string` Specifies the type of proxy header to append before sending data to the backend. Default value: "NONE" Possible values: \["NONE", "PROXY_V1"\]. |
| `httpsHealthCheck.requestPath` *Optional* | `string` The request path of the HTTPS health check request. The default value is /. |
| `httpsHealthCheck.response` *Optional* | `string` The bytes to match against the beginning of the response data. If left empty (the default value), any response will indicate health. The response data can only be ASCII. |
| `location` *Required* | `string` Location represents the geographical location of the ComputeHealthCheck. Specify a region name or "global" for global resources. Reference: Google Cloud definition of regions/zones (https://cloud.google.com/compute/docs/regions-zones/) |
| `logConfig` *Optional* | `object` Configure logging on this health check. |
| `logConfig.enable` *Optional* | `boolean` Indicates whether or not to export logs. This is false by default, which means no health check logging will be done. |
| `resourceID` *Optional* | `string` Immutable. Optional. The name of the resource. Used for creation and acquisition. When unset, the value of \`metadata.name\` is used as the default. |
| `sourceRegions` *Optional* | `list (string)` The list of cloud regions from which health checks are performed. If any regions are specified, then exactly 3 regions should be specified. The region names must be valid names of Google Cloud regions. This can only be set for global health check. If this list is non-empty, then there are restrictions on what other health check fields are supported and what other resources can use this health check: \* SSL, HTTP2, and GRPC protocols are not supported. \* The TCP request field is not supported. \* The proxyHeader field for HTTP, HTTPS, and TCP is not supported. \* The checkIntervalSec field must be at least 30. \* The health check cannot be used with BackendService nor with managed instance group auto-healing. |
| `sourceRegions[]` *Optional* | `string` <br /> |
| `sslHealthCheck` *Optional* | `object` <br /> |
| `sslHealthCheck.port` *Optional* | `integer` The TCP port number for the SSL health check request. The default value is 443. |
| `sslHealthCheck.portName` *Optional* | `string` Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. |
| `sslHealthCheck.portSpecification` *Optional* | `string` Specifies how port is selected for health checking, can be one of the following values: \* 'USE_FIXED_PORT': The port number in 'port' is used for health checking. \* 'USE_NAMED_PORT': The 'portName' is used for health checking. \* 'USE_SERVING_PORT': For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. If not specified, SSL health check follows behavior specified in 'port' and 'portName' fields. Possible values: \["USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"\]. |
| `sslHealthCheck.proxyHeader` *Optional* | `string` Specifies the type of proxy header to append before sending data to the backend. Default value: "NONE" Possible values: \["NONE", "PROXY_V1"\]. |
| `sslHealthCheck.request` *Optional* | `string` The application data to send once the SSL connection has been established (default value is empty). If both request and response are empty, the connection establishment alone will indicate health. The request data can only be ASCII. |
| `sslHealthCheck.response` *Optional* | `string` The bytes to match against the beginning of the response data. If left empty (the default value), any response will indicate health. The response data can only be ASCII. |
| `tcpHealthCheck` *Optional* | `object` <br /> |
| `tcpHealthCheck.port` *Optional* | `integer` The TCP port number for the TCP health check request. The default value is 443. |
| `tcpHealthCheck.portName` *Optional* | `string` Port name as defined in InstanceGroup#NamedPort#name. If both port and port_name are defined, port takes precedence. |
| `tcpHealthCheck.portSpecification` *Optional* | `string` Specifies how port is selected for health checking, can be one of the following values: \* 'USE_FIXED_PORT': The port number in 'port' is used for health checking. \* 'USE_NAMED_PORT': The 'portName' is used for health checking. \* 'USE_SERVING_PORT': For NetworkEndpointGroup, the port specified for each network endpoint is used for health checking. For other backends, the port or named port specified in the Backend Service is used for health checking. If not specified, TCP health check follows behavior specified in 'port' and 'portName' fields. Possible values: \["USE_FIXED_PORT", "USE_NAMED_PORT", "USE_SERVING_PORT"\]. |
| `tcpHealthCheck.proxyHeader` *Optional* | `string` Specifies the type of proxy header to append before sending data to the backend. Default value: "NONE" Possible values: \["NONE", "PROXY_V1"\]. |
| `tcpHealthCheck.request` *Optional* | `string` The application data to send once the TCP connection has been established (default value is empty). If both request and response are empty, the connection establishment alone will indicate health. The request data can only be ASCII. |
| `tcpHealthCheck.response` *Optional* | `string` The bytes to match against the beginning of the response data. If left empty (the default value), any response will indicate health. The response data can only be ASCII. |
| `timeoutSec` *Optional* | `integer` 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. |
| `unhealthyThreshold` *Optional* | `integer` A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. |

### Status

#### Schema

    conditions:
    - lastTransitionTime: string
      message: string
      reason: string
      status: string
      type: string
    creationTimestamp: string
    observedGeneration: integer
    selfLink: string
    type: string

| Fields ||
|---|---|
| `conditions` | `list (object)` Conditions represent the latest available observations of the ComputeHealthCheck's current state. |
| `conditions[]` | `object` <br /> |
| `conditions[].lastTransitionTime` | `string` Last time the condition transitioned from one status to another. |
| `conditions[].message` | `string` Human-readable message indicating details about last transition. |
| `conditions[].reason` | `string` Unique, one-word, CamelCase reason for the condition's last transition. |
| `conditions[].status` | `string` Status is the status of the condition. Can be True, False, Unknown. |
| `conditions[].type` | `string` Type is the type of the condition. |
| `creationTimestamp` | `string` Creation timestamp in RFC3339 text format. |
| `observedGeneration` | `integer` ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. |
| `selfLink` | `string` Server-defined URL for the resource. |
| `type` | `string` The type of the health check. One of HTTP, HTTPS, TCP, or SSL. |

## Sample YAML(s)

### Global Health Check

    # Copyright 2020 Google LLC
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeHealthCheck
    metadata:
      name: computehealthcheck-sample-global
    spec:
      checkIntervalSec: 10
      httpHealthCheck:
        port: 80
      location: global

### Regional Health Check

    # Copyright 2020 Google LLC
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    apiVersion: compute.cnrm.cloud.google.com/v1beta1
    kind: ComputeHealthCheck
    metadata:
      name: computehealthcheck-sample-regional
    spec:
      checkIntervalSec: 10
      httpHealthCheck:
        port: 80
      location: us-central1

> [!NOTE]
> **Note:** If you have any trouble with instantiating the resource, refer to [Troubleshoot Config Connector](https://docs.cloud.google.com/config-connector/docs/troubleshooting).