UNPKG

@pulumi/gcp

Version:

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

431 lines • 15 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthCheck = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * 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 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}} * ``` */ 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, id, state, opts) { return new HealthCheck(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === HealthCheck.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["checkIntervalSec"] = state ? state.checkIntervalSec : undefined; resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["grpcHealthCheck"] = state ? state.grpcHealthCheck : undefined; resourceInputs["healthyThreshold"] = state ? state.healthyThreshold : undefined; resourceInputs["http2HealthCheck"] = state ? state.http2HealthCheck : undefined; resourceInputs["httpHealthCheck"] = state ? state.httpHealthCheck : undefined; resourceInputs["httpsHealthCheck"] = state ? state.httpsHealthCheck : undefined; resourceInputs["logConfig"] = state ? state.logConfig : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["selfLink"] = state ? state.selfLink : undefined; resourceInputs["sourceRegions"] = state ? state.sourceRegions : undefined; resourceInputs["sslHealthCheck"] = state ? state.sslHealthCheck : undefined; resourceInputs["tcpHealthCheck"] = state ? state.tcpHealthCheck : undefined; resourceInputs["timeoutSec"] = state ? state.timeoutSec : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["unhealthyThreshold"] = state ? state.unhealthyThreshold : undefined; } else { const args = argsOrState; resourceInputs["checkIntervalSec"] = args ? args.checkIntervalSec : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["grpcHealthCheck"] = args ? args.grpcHealthCheck : undefined; resourceInputs["healthyThreshold"] = args ? args.healthyThreshold : undefined; resourceInputs["http2HealthCheck"] = args ? args.http2HealthCheck : undefined; resourceInputs["httpHealthCheck"] = args ? args.httpHealthCheck : undefined; resourceInputs["httpsHealthCheck"] = args ? args.httpsHealthCheck : undefined; resourceInputs["logConfig"] = args ? args.logConfig : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["sourceRegions"] = args ? args.sourceRegions : undefined; resourceInputs["sslHealthCheck"] = args ? args.sslHealthCheck : undefined; resourceInputs["tcpHealthCheck"] = args ? args.tcpHealthCheck : undefined; resourceInputs["timeoutSec"] = args ? args.timeoutSec : undefined; resourceInputs["unhealthyThreshold"] = args ? args.unhealthyThreshold : undefined; resourceInputs["creationTimestamp"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; resourceInputs["type"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(HealthCheck.__pulumiType, name, resourceInputs, opts); } } exports.HealthCheck = HealthCheck; /** @internal */ HealthCheck.__pulumiType = 'gcp:compute/healthCheck:HealthCheck'; //# sourceMappingURL=healthCheck.js.map