Package com.pulumi.gcp.compute
Class HealthCheck
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.gcp.compute.HealthCheck
-
public class HealthCheck extends com.pulumi.resources.CustomResource
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. ~>**NOTE**: Legacy HTTP(S) health checks must be used for target pool-based network load balancers. See the [official guide](https://cloud.google.com/load-balancing/docs/health-check-concepts#selecting_hc) for choosing a type of health check. To get more information about HealthCheck, see: * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks) * How-to Guides * [Official Documentation](https://cloud.google.com/load-balancing/docs/health-checks) ## Example Usage ### Health Check Tcp ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var tcp_health_check = new HealthCheck("tcp-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder() .port("80") .build()) .timeoutSec(1) .build()); } } ``` ### Health Check Tcp Full ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var tcp_health_check = new HealthCheck("tcp-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .description("Health check via tcp") .healthyThreshold(4) .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder() .portName("health-check-port") .portSpecification("USE_NAMED_PORT") .proxyHeader("NONE") .request("ARE YOU HEALTHY?") .response("I AM HEALTHY") .build()) .timeoutSec(1) .unhealthyThreshold(5) .build()); } } ``` ### Health Check Ssl ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckSslHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var ssl_health_check = new HealthCheck("ssl-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .sslHealthCheck(HealthCheckSslHealthCheckArgs.builder() .port("443") .build()) .timeoutSec(1) .build()); } } ``` ### Health Check Ssl Full ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckSslHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var ssl_health_check = new HealthCheck("ssl-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .description("Health check via ssl") .healthyThreshold(4) .sslHealthCheck(HealthCheckSslHealthCheckArgs.builder() .portName("health-check-port") .portSpecification("USE_NAMED_PORT") .proxyHeader("NONE") .request("ARE YOU HEALTHY?") .response("I AM HEALTHY") .build()) .timeoutSec(1) .unhealthyThreshold(5) .build()); } } ``` ### Health Check Http ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckHttpHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var http_health_check = new HealthCheck("http-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .httpHealthCheck(HealthCheckHttpHealthCheckArgs.builder() .port(80) .build()) .timeoutSec(1) .build()); } } ``` ### Health Check Http Full ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckHttpHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var http_health_check = new HealthCheck("http-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .description("Health check via http") .healthyThreshold(4) .httpHealthCheck(HealthCheckHttpHealthCheckArgs.builder() .host("1.2.3.4") .portName("health-check-port") .portSpecification("USE_NAMED_PORT") .proxyHeader("NONE") .requestPath("/mypath") .response("I AM HEALTHY") .build()) .timeoutSec(1) .unhealthyThreshold(5) .build()); } } ``` ### Health Check Https ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckHttpsHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var https_health_check = new HealthCheck("https-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .httpsHealthCheck(HealthCheckHttpsHealthCheckArgs.builder() .port("443") .build()) .timeoutSec(1) .build()); } } ``` ### Health Check Https Full ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckHttpsHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var https_health_check = new HealthCheck("https-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .description("Health check via https") .healthyThreshold(4) .httpsHealthCheck(HealthCheckHttpsHealthCheckArgs.builder() .host("1.2.3.4") .portName("health-check-port") .portSpecification("USE_NAMED_PORT") .proxyHeader("NONE") .requestPath("/mypath") .response("I AM HEALTHY") .build()) .timeoutSec(1) .unhealthyThreshold(5) .build()); } } ``` ### Health Check Http2 ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckHttp2HealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var http2_health_check = new HealthCheck("http2-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .http2HealthCheck(HealthCheckHttp2HealthCheckArgs.builder() .port("443") .build()) .timeoutSec(1) .build()); } } ``` ### Health Check Http2 Full ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckHttp2HealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var http2_health_check = new HealthCheck("http2-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .description("Health check via http2") .healthyThreshold(4) .http2HealthCheck(HealthCheckHttp2HealthCheckArgs.builder() .host("1.2.3.4") .portName("health-check-port") .portSpecification("USE_NAMED_PORT") .proxyHeader("NONE") .requestPath("/mypath") .response("I AM HEALTHY") .build()) .timeoutSec(1) .unhealthyThreshold(5) .build()); } } ``` ### Health Check Grpc ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckGrpcHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var grpc_health_check = new HealthCheck("grpc-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .grpcHealthCheck(HealthCheckGrpcHealthCheckArgs.builder() .port("443") .build()) .timeoutSec(1) .build()); } } ``` ### Health Check Grpc Full ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckGrpcHealthCheckArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var grpc_health_check = new HealthCheck("grpc-health-check", HealthCheckArgs.builder() .checkIntervalSec(1) .grpcHealthCheck(HealthCheckGrpcHealthCheckArgs.builder() .grpcServiceName("testservice") .portName("health-check-port") .portSpecification("USE_NAMED_PORT") .build()) .timeoutSec(1) .build()); } } ``` ### Health Check With Logging ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.HealthCheck; import com.pulumi.gcp.compute.HealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs; import com.pulumi.gcp.compute.inputs.HealthCheckLogConfigArgs; import com.pulumi.resources.CustomResourceOptions; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var health_check_with_logging = new HealthCheck("health-check-with-logging", HealthCheckArgs.builder() .timeoutSec(1) .checkIntervalSec(1) .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder() .port("22") .build()) .logConfig(HealthCheckLogConfigArgs.builder() .enable(true) .build()) .build(), CustomResourceOptions.builder() .provider(google_beta) .build()); } } ``` ## Import HealthCheck can be imported using any of these accepted formats ```sh $ pulumi import gcp:compute/healthCheck:HealthCheck default projects/{{project}}/global/healthChecks/{{name}} ``` ```sh $ pulumi import gcp:compute/healthCheck:HealthCheck default {{project}}/{{name}} ``` ```sh $ pulumi import gcp:compute/healthCheck:HealthCheck default {{name}} ```
-
-
Constructor Summary
Constructors Constructor Description HealthCheck(java.lang.String name)
HealthCheck(java.lang.String name, HealthCheckArgs args)
HealthCheck(java.lang.String name, HealthCheckArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>
checkIntervalSec()
com.pulumi.core.Output<java.lang.String>
creationTimestamp()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
description()
static HealthCheck
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, HealthCheckState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<HealthCheckGrpcHealthCheck>>
grpcHealthCheck()
com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>
healthyThreshold()
com.pulumi.core.Output<java.util.Optional<HealthCheckHttp2HealthCheck>>
http2HealthCheck()
com.pulumi.core.Output<java.util.Optional<HealthCheckHttpHealthCheck>>
httpHealthCheck()
com.pulumi.core.Output<java.util.Optional<HealthCheckHttpsHealthCheck>>
httpsHealthCheck()
com.pulumi.core.Output<HealthCheckLogConfig>
logConfig()
com.pulumi.core.Output<java.lang.String>
name()
com.pulumi.core.Output<java.lang.String>
project()
com.pulumi.core.Output<java.lang.String>
selfLink()
com.pulumi.core.Output<java.util.Optional<HealthCheckSslHealthCheck>>
sslHealthCheck()
com.pulumi.core.Output<java.util.Optional<HealthCheckTcpHealthCheck>>
tcpHealthCheck()
com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>
timeoutSec()
com.pulumi.core.Output<java.lang.String>
type()
com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>
unhealthyThreshold()
-
-
-
Constructor Detail
-
HealthCheck
public HealthCheck(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
HealthCheck
public HealthCheck(java.lang.String name, @Nullable HealthCheckArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
HealthCheck
public HealthCheck(java.lang.String name, @Nullable HealthCheckArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
checkIntervalSec
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> checkIntervalSec()
- Returns:
- How often (in seconds) to send a health check. The default value is 5 seconds.
-
creationTimestamp
public com.pulumi.core.Output<java.lang.String> creationTimestamp()
- Returns:
- Creation timestamp in RFC3339 text format.
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- An optional description of this resource. Provide this property when you create the resource.
-
grpcHealthCheck
public com.pulumi.core.Output<java.util.Optional<HealthCheckGrpcHealthCheck>> grpcHealthCheck()
- Returns:
- A nested object resource Structure is documented below.
-
healthyThreshold
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> healthyThreshold()
- Returns:
- A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2.
-
http2HealthCheck
public com.pulumi.core.Output<java.util.Optional<HealthCheckHttp2HealthCheck>> http2HealthCheck()
- Returns:
- A nested object resource Structure is documented below.
-
httpHealthCheck
public com.pulumi.core.Output<java.util.Optional<HealthCheckHttpHealthCheck>> httpHealthCheck()
- Returns:
- A nested object resource Structure is documented below.
-
httpsHealthCheck
public com.pulumi.core.Output<java.util.Optional<HealthCheckHttpsHealthCheck>> httpsHealthCheck()
- Returns:
- A nested object resource Structure is documented below.
-
logConfig
public com.pulumi.core.Output<HealthCheckLogConfig> logConfig()
- Returns:
- Configure logging on this health check. Structure is documented below.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- 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
public com.pulumi.core.Output<java.lang.String> project()
- Returns:
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
-
selfLink
public com.pulumi.core.Output<java.lang.String> selfLink()
- Returns:
- The URI of the created resource.
-
sslHealthCheck
public com.pulumi.core.Output<java.util.Optional<HealthCheckSslHealthCheck>> sslHealthCheck()
- Returns:
- A nested object resource Structure is documented below.
-
tcpHealthCheck
public com.pulumi.core.Output<java.util.Optional<HealthCheckTcpHealthCheck>> tcpHealthCheck()
- Returns:
- A nested object resource Structure is documented below.
-
timeoutSec
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> timeoutSec()
- Returns:
- 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
public com.pulumi.core.Output<java.lang.String> type()
- Returns:
- The type of the health check. One of HTTP, HTTPS, TCP, or SSL.
-
unhealthyThreshold
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> unhealthyThreshold()
- Returns:
- A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2.
-
get
public static HealthCheck get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable HealthCheckState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-