Show / Hide Table of Contents

Class HealthCheck

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 HealthCheck, see:

  • API documentation
  • How-to Guides
  • Official Documentation

Example Usage - Health Check Tcp

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var tcp_health_check = new Gcp.Compute.HealthCheck("tcp-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
        {
            Port = "80",
        },
        TimeoutSec = 1,
    });
}

}

Example Usage - Health Check Tcp Full

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var tcp_health_check = new Gcp.Compute.HealthCheck("tcp-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        Description = "Health check via tcp",
        HealthyThreshold = 4,
        TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
        {
            PortName = "health-check-port",
            PortSpecification = "USE_NAMED_PORT",
            ProxyHeader = "NONE",
            Request = "ARE YOU HEALTHY?",
            Response = "I AM HEALTHY",
        },
        TimeoutSec = 1,
        UnhealthyThreshold = 5,
    });
}

}

Example Usage - Health Check Ssl

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var ssl_health_check = new Gcp.Compute.HealthCheck("ssl-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        SslHealthCheck = new Gcp.Compute.Inputs.HealthCheckSslHealthCheckArgs
        {
            Port = "443",
        },
        TimeoutSec = 1,
    });
}

}

Example Usage - Health Check Ssl Full

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var ssl_health_check = new Gcp.Compute.HealthCheck("ssl-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        Description = "Health check via ssl",
        HealthyThreshold = 4,
        SslHealthCheck = new Gcp.Compute.Inputs.HealthCheckSslHealthCheckArgs
        {
            PortName = "health-check-port",
            PortSpecification = "USE_NAMED_PORT",
            ProxyHeader = "NONE",
            Request = "ARE YOU HEALTHY?",
            Response = "I AM HEALTHY",
        },
        TimeoutSec = 1,
        UnhealthyThreshold = 5,
    });
}

}

Example Usage - Health Check Http

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var http_health_check = new Gcp.Compute.HealthCheck("http-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        HttpHealthCheck = new Gcp.Compute.Inputs.HealthCheckHttpHealthCheckArgs
        {
            Port = 80,
        },
        TimeoutSec = 1,
    });
}

}

Example Usage - Health Check Http Full

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var http_health_check = new Gcp.Compute.HealthCheck("http-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        Description = "Health check via http",
        HealthyThreshold = 4,
        HttpHealthCheck = new Gcp.Compute.Inputs.HealthCheckHttpHealthCheckArgs
        {
            Host = "1.2.3.4",
            PortName = "health-check-port",
            PortSpecification = "USE_NAMED_PORT",
            ProxyHeader = "NONE",
            RequestPath = "/mypath",
            Response = "I AM HEALTHY",
        },
        TimeoutSec = 1,
        UnhealthyThreshold = 5,
    });
}

}

Example Usage - Health Check Https

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var https_health_check = new Gcp.Compute.HealthCheck("https-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        HttpsHealthCheck = new Gcp.Compute.Inputs.HealthCheckHttpsHealthCheckArgs
        {
            Port = "443",
        },
        TimeoutSec = 1,
    });
}

}

Example Usage - Health Check Https Full

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var https_health_check = new Gcp.Compute.HealthCheck("https-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        Description = "Health check via https",
        HealthyThreshold = 4,
        HttpsHealthCheck = new Gcp.Compute.Inputs.HealthCheckHttpsHealthCheckArgs
        {
            Host = "1.2.3.4",
            PortName = "health-check-port",
            PortSpecification = "USE_NAMED_PORT",
            ProxyHeader = "NONE",
            RequestPath = "/mypath",
            Response = "I AM HEALTHY",
        },
        TimeoutSec = 1,
        UnhealthyThreshold = 5,
    });
}

}

Example Usage - Health Check Http2

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var http2_health_check = new Gcp.Compute.HealthCheck("http2-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        Http2HealthCheck = new Gcp.Compute.Inputs.HealthCheckHttp2HealthCheckArgs
        {
            Port = "443",
        },
        TimeoutSec = 1,
    });
}

}

Example Usage - Health Check Http2 Full

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var http2_health_check = new Gcp.Compute.HealthCheck("http2-health-check", new Gcp.Compute.HealthCheckArgs
    {
        CheckIntervalSec = 1,
        Description = "Health check via http2",
        HealthyThreshold = 4,
        Http2HealthCheck = new Gcp.Compute.Inputs.HealthCheckHttp2HealthCheckArgs
        {
            Host = "1.2.3.4",
            PortName = "health-check-port",
            PortSpecification = "USE_NAMED_PORT",
            ProxyHeader = "NONE",
            RequestPath = "/mypath",
            Response = "I AM HEALTHY",
        },
        TimeoutSec = 1,
        UnhealthyThreshold = 5,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
HealthCheck
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.Compute
Assembly: Pulumi.Gcp.dll
Syntax
public class HealthCheck : CustomResource

Constructors

View Source

HealthCheck(String, HealthCheckArgs, CustomResourceOptions)

Create a HealthCheck resource with the given unique name, arguments, and options.

Declaration
public HealthCheck(string name, HealthCheckArgs args = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

HealthCheckArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

CheckIntervalSec

How often (in seconds) to send a health check. The default value is 5 seconds.

Declaration
public Output<int?> CheckIntervalSec { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

CreationTimestamp

Creation timestamp in RFC3339 text format.

Declaration
public Output<string> CreationTimestamp { get; }
Property Value
Type Description
Output<System.String>
View Source

Description

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

Declaration
public Output<string> Description { get; }
Property Value
Type Description
Output<System.String>
View Source

HealthyThreshold

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

Declaration
public Output<int?> HealthyThreshold { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

Http2HealthCheck

A nested object resource Structure is documented below.

Declaration
public Output<HealthCheckHttp2HealthCheck> Http2HealthCheck { get; }
Property Value
Type Description
Output<HealthCheckHttp2HealthCheck>
View Source

HttpHealthCheck

A nested object resource Structure is documented below.

Declaration
public Output<HealthCheckHttpHealthCheck> HttpHealthCheck { get; }
Property Value
Type Description
Output<HealthCheckHttpHealthCheck>
View Source

HttpsHealthCheck

A nested object resource Structure is documented below.

Declaration
public Output<HealthCheckHttpsHealthCheck> HttpsHealthCheck { get; }
Property Value
Type Description
Output<HealthCheckHttpsHealthCheck>
View Source

LogConfig

Configure logging on this health check. Structure is documented below.

Declaration
public Output<HealthCheckLogConfig> LogConfig { get; }
Property Value
Type Description
Output<HealthCheckLogConfig>
View Source

Name

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.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

Project

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

SelfLink

The URI of the created resource.

Declaration
public Output<string> SelfLink { get; }
Property Value
Type Description
Output<System.String>
View Source

SslHealthCheck

A nested object resource Structure is documented below.

Declaration
public Output<HealthCheckSslHealthCheck> SslHealthCheck { get; }
Property Value
Type Description
Output<HealthCheckSslHealthCheck>
View Source

TcpHealthCheck

A nested object resource Structure is documented below.

Declaration
public Output<HealthCheckTcpHealthCheck> TcpHealthCheck { get; }
Property Value
Type Description
Output<HealthCheckTcpHealthCheck>
View Source

TimeoutSec

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.

Declaration
public Output<int?> TimeoutSec { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

Type

The type of the health check. One of HTTP, HTTPS, TCP, or SSL.

Declaration
public Output<string> Type { get; }
Property Value
Type Description
Output<System.String>
View Source

UnhealthyThreshold

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

Declaration
public Output<int?> UnhealthyThreshold { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>

Methods

View Source

Get(String, Input<String>, HealthCheckState, CustomResourceOptions)

Get an existing HealthCheck resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static HealthCheck Get(string name, Input<string> id, HealthCheckState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

HealthCheckState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
HealthCheck
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.