UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

734 lines (733 loc) • 25.2 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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 * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const tcp_health_check = new gcp.compute.HealthCheck("tcp-health-check", { * name: "tcp-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * tcpHealthCheck: { * port: 80, * }, * }); * ``` * ### Health Check Tcp Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const tcp_health_check = new gcp.compute.HealthCheck("tcp-health-check", { * name: "tcp-health-check", * description: "Health check via tcp", * timeoutSec: 1, * checkIntervalSec: 1, * healthyThreshold: 4, * unhealthyThreshold: 5, * tcpHealthCheck: { * portName: "health-check-port", * portSpecification: "USE_NAMED_PORT", * request: "ARE YOU HEALTHY?", * proxyHeader: "NONE", * response: "I AM HEALTHY", * }, * }); * ``` * ### Health Check Ssl * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const ssl_health_check = new gcp.compute.HealthCheck("ssl-health-check", { * name: "ssl-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * sslHealthCheck: { * port: 443, * }, * }); * ``` * ### Health Check Ssl Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const ssl_health_check = new gcp.compute.HealthCheck("ssl-health-check", { * name: "ssl-health-check", * description: "Health check via ssl", * timeoutSec: 1, * checkIntervalSec: 1, * healthyThreshold: 4, * unhealthyThreshold: 5, * sslHealthCheck: { * portName: "health-check-port", * portSpecification: "USE_NAMED_PORT", * request: "ARE YOU HEALTHY?", * proxyHeader: "NONE", * response: "I AM HEALTHY", * }, * }); * ``` * ### Health Check Http * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const http_health_check = new gcp.compute.HealthCheck("http-health-check", { * name: "http-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * httpHealthCheck: { * port: 80, * }, * }); * ``` * ### Health Check Http Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const http_health_check = new gcp.compute.HealthCheck("http-health-check", { * name: "http-health-check", * description: "Health check via http", * timeoutSec: 1, * checkIntervalSec: 1, * healthyThreshold: 4, * unhealthyThreshold: 5, * httpHealthCheck: { * portName: "health-check-port", * portSpecification: "USE_NAMED_PORT", * host: "1.2.3.4", * requestPath: "/mypath", * proxyHeader: "NONE", * response: "I AM HEALTHY", * }, * }); * ``` * ### Health Check Https * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const https_health_check = new gcp.compute.HealthCheck("https-health-check", { * name: "https-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * httpsHealthCheck: { * port: 443, * }, * }); * ``` * ### Health Check Https Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const https_health_check = new gcp.compute.HealthCheck("https-health-check", { * name: "https-health-check", * description: "Health check via https", * timeoutSec: 1, * checkIntervalSec: 1, * healthyThreshold: 4, * unhealthyThreshold: 5, * httpsHealthCheck: { * portName: "health-check-port", * portSpecification: "USE_NAMED_PORT", * host: "1.2.3.4", * requestPath: "/mypath", * proxyHeader: "NONE", * response: "I AM HEALTHY", * }, * }); * ``` * ### Health Check Http2 * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const http2_health_check = new gcp.compute.HealthCheck("http2-health-check", { * name: "http2-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * http2HealthCheck: { * port: 443, * }, * }); * ``` * ### Health Check Http2 Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const http2_health_check = new gcp.compute.HealthCheck("http2-health-check", { * name: "http2-health-check", * description: "Health check via http2", * timeoutSec: 1, * checkIntervalSec: 1, * healthyThreshold: 4, * unhealthyThreshold: 5, * http2HealthCheck: { * portName: "health-check-port", * portSpecification: "USE_NAMED_PORT", * host: "1.2.3.4", * requestPath: "/mypath", * proxyHeader: "NONE", * response: "I AM HEALTHY", * }, * }); * ``` * ### Health Check Grpc * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const grpc_health_check = new gcp.compute.HealthCheck("grpc-health-check", { * name: "grpc-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * grpcHealthCheck: { * port: 443, * }, * }); * ``` * ### Health Check Grpc Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const grpc_health_check = new gcp.compute.HealthCheck("grpc-health-check", { * name: "grpc-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * grpcHealthCheck: { * portName: "health-check-port", * portSpecification: "USE_NAMED_PORT", * grpcServiceName: "testservice", * }, * }); * ``` * ### Health Check Grpc With Tls * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const grpc_with_tls_health_check = new gcp.compute.HealthCheck("grpc-with-tls-health-check", { * name: "grpc-with-tls-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * grpcTlsHealthCheck: { * port: 443, * }, * }); * ``` * ### Health Check Grpc With Tls Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const grpc_with_tls_health_check = new gcp.compute.HealthCheck("grpc-with-tls-health-check", { * name: "grpc-with-tls-health-check", * description: "Health check via grpc with TLS", * timeoutSec: 1, * checkIntervalSec: 1, * healthyThreshold: 4, * unhealthyThreshold: 5, * grpcTlsHealthCheck: { * portSpecification: "USE_FIXED_PORT", * port: 443, * grpcServiceName: "testservice", * }, * }); * ``` * ### Health Check With Logging * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const health_check_with_logging = new gcp.compute.HealthCheck("health-check-with-logging", { * name: "tcp-health-check", * timeoutSec: 1, * checkIntervalSec: 1, * tcpHealthCheck: { * port: 22, * }, * logConfig: { * enable: true, * }, * }); * ``` * ### Compute Health Check Http Source Regions * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const http_health_check_with_source_regions = new gcp.compute.HealthCheck("http-health-check-with-source-regions", { * name: "http-health-check", * checkIntervalSec: 30, * httpHealthCheck: { * port: 80, * portSpecification: "USE_FIXED_PORT", * }, * sourceRegions: [ * "us-west1", * "us-central1", * "us-east5", * ], * }); * ``` * ### Compute Health Check Https Source Regions * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const https_health_check_with_source_regions = new gcp.compute.HealthCheck("https-health-check-with-source-regions", { * name: "https-health-check", * checkIntervalSec: 30, * httpsHealthCheck: { * port: 80, * portSpecification: "USE_FIXED_PORT", * }, * sourceRegions: [ * "us-west1", * "us-central1", * "us-east5", * ], * }); * ``` * ### Compute Health Check Tcp Source Regions * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const tcp_health_check_with_source_regions = new gcp.compute.HealthCheck("tcp-health-check-with-source-regions", { * name: "tcp-health-check", * checkIntervalSec: 30, * tcpHealthCheck: { * port: 80, * portSpecification: "USE_FIXED_PORT", * }, * sourceRegions: [ * "us-west1", * "us-central1", * "us-east5", * ], * }); * ``` * * ## Import * * HealthCheck can be imported using any of these accepted formats: * * * `projects/{{project}}/global/healthChecks/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, HealthCheck can be imported using one of the formats above. For example: * * ```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}} * ``` */ export declare class HealthCheck extends pulumi.CustomResource { /** * Get an existing HealthCheck resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: HealthCheckState, opts?: pulumi.CustomResourceOptions): HealthCheck; /** * Returns true if the given object is an instance of HealthCheck. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is HealthCheck; /** * How often (in seconds) to send a health check. The default value is 5 * seconds. */ readonly checkIntervalSec: pulumi.Output<number | undefined>; /** * Creation timestamp in RFC3339 text format. */ readonly creationTimestamp: pulumi.Output<string>; /** * An optional description of this resource. Provide this property when * you create the resource. */ readonly description: pulumi.Output<string | undefined>; /** * A nested object resource. * Structure is documented below. */ readonly grpcHealthCheck: pulumi.Output<outputs.compute.HealthCheckGrpcHealthCheck | undefined>; /** * A nested object resource. * Structure is documented below. */ readonly grpcTlsHealthCheck: pulumi.Output<outputs.compute.HealthCheckGrpcTlsHealthCheck | undefined>; /** * A so-far unhealthy instance will be marked healthy after this many * consecutive successes. The default value is 2. */ readonly healthyThreshold: pulumi.Output<number | undefined>; /** * A nested object resource. * Structure is documented below. */ readonly http2HealthCheck: pulumi.Output<outputs.compute.HealthCheckHttp2HealthCheck | undefined>; /** * A nested object resource. * Structure is documented below. */ readonly httpHealthCheck: pulumi.Output<outputs.compute.HealthCheckHttpHealthCheck | undefined>; /** * A nested object resource. * Structure is documented below. */ readonly httpsHealthCheck: pulumi.Output<outputs.compute.HealthCheckHttpsHealthCheck | undefined>; /** * Configure logging on this health check. * Structure is documented below. */ readonly logConfig: pulumi.Output<outputs.compute.HealthCheckLogConfig>; /** * 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. */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The URI of the created resource. */ readonly selfLink: pulumi.Output<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. */ readonly sourceRegions: pulumi.Output<string[] | undefined>; /** * A nested object resource. * Structure is documented below. */ readonly sslHealthCheck: pulumi.Output<outputs.compute.HealthCheckSslHealthCheck | undefined>; /** * A nested object resource. * Structure is documented below. */ readonly tcpHealthCheck: pulumi.Output<outputs.compute.HealthCheckTcpHealthCheck | undefined>; /** * 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. */ readonly timeoutSec: pulumi.Output<number | undefined>; /** * The type of the health check. One of HTTP, HTTPS, TCP, or SSL. */ readonly type: pulumi.Output<string>; /** * A so-far healthy instance will be marked unhealthy after this many * consecutive failures. The default value is 2. */ readonly unhealthyThreshold: pulumi.Output<number | undefined>; /** * Create a HealthCheck resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: HealthCheckArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering HealthCheck resources. */ export interface HealthCheckState { /** * How often (in seconds) to send a health check. The default value is 5 * seconds. */ checkIntervalSec?: pulumi.Input<number>; /** * Creation timestamp in RFC3339 text format. */ creationTimestamp?: pulumi.Input<string>; /** * An optional description of this resource. Provide this property when * you create the resource. */ description?: pulumi.Input<string>; /** * A nested object resource. * Structure is documented below. */ grpcHealthCheck?: pulumi.Input<inputs.compute.HealthCheckGrpcHealthCheck>; /** * A nested object resource. * Structure is documented below. */ grpcTlsHealthCheck?: pulumi.Input<inputs.compute.HealthCheckGrpcTlsHealthCheck>; /** * A so-far unhealthy instance will be marked healthy after this many * consecutive successes. The default value is 2. */ healthyThreshold?: pulumi.Input<number>; /** * A nested object resource. * Structure is documented below. */ http2HealthCheck?: pulumi.Input<inputs.compute.HealthCheckHttp2HealthCheck>; /** * A nested object resource. * Structure is documented below. */ httpHealthCheck?: pulumi.Input<inputs.compute.HealthCheckHttpHealthCheck>; /** * A nested object resource. * Structure is documented below. */ httpsHealthCheck?: pulumi.Input<inputs.compute.HealthCheckHttpsHealthCheck>; /** * Configure logging on this health check. * Structure is documented below. */ logConfig?: pulumi.Input<inputs.compute.HealthCheckLogConfig>; /** * 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. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The URI of the created resource. */ selfLink?: pulumi.Input<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?: pulumi.Input<pulumi.Input<string>[]>; /** * A nested object resource. * Structure is documented below. */ sslHealthCheck?: pulumi.Input<inputs.compute.HealthCheckSslHealthCheck>; /** * A nested object resource. * Structure is documented below. */ tcpHealthCheck?: pulumi.Input<inputs.compute.HealthCheckTcpHealthCheck>; /** * 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. */ timeoutSec?: pulumi.Input<number>; /** * The type of the health check. One of HTTP, HTTPS, TCP, or SSL. */ type?: pulumi.Input<string>; /** * A so-far healthy instance will be marked unhealthy after this many * consecutive failures. The default value is 2. */ unhealthyThreshold?: pulumi.Input<number>; } /** * The set of arguments for constructing a HealthCheck resource. */ export interface HealthCheckArgs { /** * How often (in seconds) to send a health check. The default value is 5 * seconds. */ checkIntervalSec?: pulumi.Input<number>; /** * An optional description of this resource. Provide this property when * you create the resource. */ description?: pulumi.Input<string>; /** * A nested object resource. * Structure is documented below. */ grpcHealthCheck?: pulumi.Input<inputs.compute.HealthCheckGrpcHealthCheck>; /** * A nested object resource. * Structure is documented below. */ grpcTlsHealthCheck?: pulumi.Input<inputs.compute.HealthCheckGrpcTlsHealthCheck>; /** * A so-far unhealthy instance will be marked healthy after this many * consecutive successes. The default value is 2. */ healthyThreshold?: pulumi.Input<number>; /** * A nested object resource. * Structure is documented below. */ http2HealthCheck?: pulumi.Input<inputs.compute.HealthCheckHttp2HealthCheck>; /** * A nested object resource. * Structure is documented below. */ httpHealthCheck?: pulumi.Input<inputs.compute.HealthCheckHttpHealthCheck>; /** * A nested object resource. * Structure is documented below. */ httpsHealthCheck?: pulumi.Input<inputs.compute.HealthCheckHttpsHealthCheck>; /** * Configure logging on this health check. * Structure is documented below. */ logConfig?: pulumi.Input<inputs.compute.HealthCheckLogConfig>; /** * 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. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<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?: pulumi.Input<pulumi.Input<string>[]>; /** * A nested object resource. * Structure is documented below. */ sslHealthCheck?: pulumi.Input<inputs.compute.HealthCheckSslHealthCheck>; /** * A nested object resource. * Structure is documented below. */ tcpHealthCheck?: pulumi.Input<inputs.compute.HealthCheckTcpHealthCheck>; /** * 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. */ timeoutSec?: pulumi.Input<number>; /** * A so-far healthy instance will be marked unhealthy after this many * consecutive failures. The default value is 2. */ unhealthyThreshold?: pulumi.Input<number>; }